diff --git a/documentation.yaml b/documentation.yaml new file mode 100644 index 0000000..4e56220 --- /dev/null +++ b/documentation.yaml @@ -0,0 +1,168 @@ +extensionName: bitmap +icon: i-bi-filetype-bmp +filesToIncludeInManual: +- USING.md +- primitives +markdownTemplate: |2 + + # Bitmap Extension for NetLogo + + This package contains the NetLogo bitmap extension. It allows you to perform manipulations like scaling, converting to grayscale, and grabbing a single channel on images and import them into the patches or drawing. + + {{> BUILDING.md}} + + {{> USING.md}} + + ## Primitives + + {{#contents}}{{#prims}} + [`{{name}}`](#{{primitive.extensionName}}{{primitive.name}}) + {{/prims}}{{/contents}} + + {{#primitives}} + {{> primTemplate}} + {{/primitives}} + + {{> LICENSE.md}} +primTemplate: |2 + + ### `{{name}}` + + ```NetLogo + {{#examples}} + {{primitive.fullName}}{{#args}} {{name}}{{/args}} + {{/examples}} + ``` + + {{{description}}} +primitives: +- arguments: + - name: image + type: bitmap + description: |2 + + Reports a 3-element list describing the amount of R, G, and B in + *image*, by summing across all pixels, and normalizing each + component by the number of pixels in the image, so each component + ranges from 0 to 255. + name: average-color + returns: list + type: reporter +- arguments: + - name: image + type: bitmap + - name: channel + type: number + description: |2 + + Extracts either the alpha, red, green, or blue channel from an image. + The input *channel* should be an integer 0-3 indicating the + channel to remove (alpha=0, red=1, green=2, blue=3). The resulting + image is a grayscale image representing specified channel. + name: channel + returns: bitmap + type: reporter +- arguments: + - name: image + type: bitmap + - name: x + type: number + - name: y + type: number + description: |2 + + Imports the given image into the drawing without scaling the image at + the given pixel coordinates. + name: copy-to-drawing + type: command +- arguments: + - name: image + type: bitmap + - name: boolean + type: boolean + description: |2 + + Imports the given image into the pcolors, scaled to fit the world. + The second input indicates whether the colors should be interpreted + as NetLogo colors or left as RGB colors. false means RGB + colors. + name: copy-to-pcolors + type: command +- arguments: + - name: image1 + type: bitmap + - name: image2 + type: bitmap + description: |2 + + Reports an image that is the absolute value of the pixel-wise RGB + difference between two images. Note that image1 and image2 MUST be + the same width and height as each other, or errors will ensue. + name: difference-rgb + returns: bitmap + type: reporter +- arguments: + - name: image + type: bitmap + - name: filename + type: string + description: Writes *image* to *filename*. + name: export + type: command +- arguments: + - name: base64-string + type: string + description: Turns a base64 encoded string into a bitmap image for use by the extension. The [Fetch](https://github.com/NetLogo/Fetch-Extension) and [Export-The](https://github.com/NetLogo/ExportThe-Extension) extensions would be common sources of these encoded strings. + name: from-base64 + returns: bitmap + type: reporter +- arguments: + - name: base64-string + type: string + description: Turns a bitmap image into a base64 encoded string with a PNG format. + name: to-base64 + returns: string + type: reporter +- description: Reports an image of the current view. + name: from-view + returns: bitmap + type: reporter +- arguments: + - name: image + type: bitmap + description: Converts the given image to grayscale. + name: to-grayscale + returns: bitmap + type: reporter +- arguments: + - name: image + type: bitmap + description: Reports the height of given *image* + name: height + returns: number + type: reporter +- arguments: + - name: filename + type: string + description: Reports a LogoBitmap containing the image at *filename*. + name: import + returns: bitmap + type: reporter +- arguments: + - name: image + type: bitmap + - name: width + type: number + - name: height + type: number + description: Reports a new image that is *image* scaled to the given *width* and *height* + name: scaled + returns: bitmap + type: reporter +- arguments: + - name: image + type: bitmap + description: Reports the width of the given *image* + name: width + returns: number + type: reporter