Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 168 additions & 0 deletions documentation.yaml
Original file line number Diff line number Diff line change
@@ -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. <code>false</code> 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