|
| 1 | +extensionName: bitmap |
| 2 | +icon: i-bi-filetype-bmp |
| 3 | +filesToIncludeInManual: |
| 4 | +- USING.md |
| 5 | +- primitives |
| 6 | +markdownTemplate: |2 |
| 7 | +
|
| 8 | + # Bitmap Extension for NetLogo |
| 9 | +
|
| 10 | + 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. |
| 11 | +
|
| 12 | + {{> BUILDING.md}} |
| 13 | +
|
| 14 | + {{> USING.md}} |
| 15 | +
|
| 16 | + ## Primitives |
| 17 | +
|
| 18 | + {{#contents}}{{#prims}} |
| 19 | + [`{{name}}`](#{{primitive.extensionName}}{{primitive.name}}) |
| 20 | + {{/prims}}{{/contents}} |
| 21 | +
|
| 22 | + {{#primitives}} |
| 23 | + {{> primTemplate}} |
| 24 | + {{/primitives}} |
| 25 | +
|
| 26 | + {{> LICENSE.md}} |
| 27 | +primTemplate: |2 |
| 28 | +
|
| 29 | + ### `{{name}}` |
| 30 | +
|
| 31 | + ```NetLogo |
| 32 | + {{#examples}} |
| 33 | + {{primitive.fullName}}{{#args}} {{name}}{{/args}} |
| 34 | + {{/examples}} |
| 35 | + ``` |
| 36 | +
|
| 37 | + {{{description}}} |
| 38 | +primitives: |
| 39 | +- arguments: |
| 40 | + - name: image |
| 41 | + type: bitmap |
| 42 | + description: |2 |
| 43 | +
|
| 44 | + Reports a 3-element list describing the amount of R, G, and B in |
| 45 | + *image*, by summing across all pixels, and normalizing each |
| 46 | + component by the number of pixels in the image, so each component |
| 47 | + ranges from 0 to 255. |
| 48 | + name: average-color |
| 49 | + returns: list |
| 50 | + type: reporter |
| 51 | +- arguments: |
| 52 | + - name: image |
| 53 | + type: bitmap |
| 54 | + - name: channel |
| 55 | + type: number |
| 56 | + description: |2 |
| 57 | +
|
| 58 | + Extracts either the alpha, red, green, or blue channel from an image. |
| 59 | + The input *channel* should be an integer 0-3 indicating the |
| 60 | + channel to remove (alpha=0, red=1, green=2, blue=3). The resulting |
| 61 | + image is a grayscale image representing specified channel. |
| 62 | + name: channel |
| 63 | + returns: bitmap |
| 64 | + type: reporter |
| 65 | +- arguments: |
| 66 | + - name: image |
| 67 | + type: bitmap |
| 68 | + - name: x |
| 69 | + type: number |
| 70 | + - name: y |
| 71 | + type: number |
| 72 | + description: |2 |
| 73 | +
|
| 74 | + Imports the given image into the drawing without scaling the image at |
| 75 | + the given pixel coordinates. |
| 76 | + name: copy-to-drawing |
| 77 | + type: command |
| 78 | +- arguments: |
| 79 | + - name: image |
| 80 | + type: bitmap |
| 81 | + - name: boolean |
| 82 | + type: boolean |
| 83 | + description: |2 |
| 84 | +
|
| 85 | + Imports the given image into the pcolors, scaled to fit the world. |
| 86 | + The second input indicates whether the colors should be interpreted |
| 87 | + as NetLogo colors or left as RGB colors. <code>false</code> means RGB |
| 88 | + colors. |
| 89 | + name: copy-to-pcolors |
| 90 | + type: command |
| 91 | +- arguments: |
| 92 | + - name: image1 |
| 93 | + type: bitmap |
| 94 | + - name: image2 |
| 95 | + type: bitmap |
| 96 | + description: |2 |
| 97 | +
|
| 98 | + Reports an image that is the absolute value of the pixel-wise RGB |
| 99 | + difference between two images. Note that image1 and image2 MUST be |
| 100 | + the same width and height as each other, or errors will ensue. |
| 101 | + name: difference-rgb |
| 102 | + returns: bitmap |
| 103 | + type: reporter |
| 104 | +- arguments: |
| 105 | + - name: image |
| 106 | + type: bitmap |
| 107 | + - name: filename |
| 108 | + type: string |
| 109 | + description: Writes *image* to *filename*. |
| 110 | + name: export |
| 111 | + type: command |
| 112 | +- arguments: |
| 113 | + - name: base64-string |
| 114 | + type: string |
| 115 | + 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. |
| 116 | + name: from-base64 |
| 117 | + returns: bitmap |
| 118 | + type: reporter |
| 119 | +- arguments: |
| 120 | + - name: base64-string |
| 121 | + type: string |
| 122 | + description: Turns a bitmap image into a base64 encoded string with a PNG format. |
| 123 | + name: to-base64 |
| 124 | + returns: string |
| 125 | + type: reporter |
| 126 | +- description: Reports an image of the current view. |
| 127 | + name: from-view |
| 128 | + returns: bitmap |
| 129 | + type: reporter |
| 130 | +- arguments: |
| 131 | + - name: image |
| 132 | + type: bitmap |
| 133 | + description: Converts the given image to grayscale. |
| 134 | + name: to-grayscale |
| 135 | + returns: bitmap |
| 136 | + type: reporter |
| 137 | +- arguments: |
| 138 | + - name: image |
| 139 | + type: bitmap |
| 140 | + description: Reports the height of given *image* |
| 141 | + name: height |
| 142 | + returns: number |
| 143 | + type: reporter |
| 144 | +- arguments: |
| 145 | + - name: filename |
| 146 | + type: string |
| 147 | + description: Reports a LogoBitmap containing the image at *filename*. |
| 148 | + name: import |
| 149 | + returns: bitmap |
| 150 | + type: reporter |
| 151 | +- arguments: |
| 152 | + - name: image |
| 153 | + type: bitmap |
| 154 | + - name: width |
| 155 | + type: number |
| 156 | + - name: height |
| 157 | + type: number |
| 158 | + description: Reports a new image that is *image* scaled to the given *width* and *height* |
| 159 | + name: scaled |
| 160 | + returns: bitmap |
| 161 | + type: reporter |
| 162 | +- arguments: |
| 163 | + - name: image |
| 164 | + type: bitmap |
| 165 | + description: Reports the width of the given *image* |
| 166 | + name: width |
| 167 | + returns: number |
| 168 | + type: reporter |
0 commit comments