NetLogo banner

 Contact Us

 Modeling Commons

 User Manuals:


NetLogo User Community Models

(back to the NetLogo User Community Models)


by James Steiner (Submitted: 8/28/2003 )

[screen shot]

Download drawing-tool
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

(You can also run this model in your browser, but we don't recommend it; details here.)


A drawing tool for NetLogo, implemented in NetLogo.
It can be used to design initial patch color arrangements.
It includes the usual tools--brush, line, circle-- and a multi-level undo / redo feature.
Basic save and load features allow color setups to be saved for use in other models.


Click drawing-tool ON to begin. If needed, the model automatically "resets".
Choose a tool and effect from the pick-lists.
Choose a brush width and brush-color.
Click in the patch area to draw.

Use to set the brush-width used by the tools.
Is always odd, as it uses integer patches


Sets the color of the brush, in increments of .0001

strength: controls the "strength" of various effects.
blend: stronger means less transparent
dapple: stronger means a wider range of shades
diffuse: stonger diffuses more
use for any control or effect that requires a value varying from 0.0 to 1.0
cycle: diffuse: repeats the diffuse function that many times
startburst: sets the gap between the lines


Brush: Sets the brush color anywhere from 0.000 to 139.999
Buttons: Sets the brush to the named color.
Darker: Affect the brush color (by even 0.5 increments)
Pure: Sets the brush color to the "pure" color, aka the center color.
Example: If brush is 19.455 (light red),
changes it to 15.000 (red)
Note: Pure uses the Center function, so darker grays become black,
and brighter grays become white.

_0.0000: Sets the brush to the darkest shade of the current color.
Example: If brush is 117.500 (lighter violet),
changes color to 110.000 (darkest violet).
_9.9999: Sets the brush to the lightest shade of the current color


Tools alter the canvas in different ways, using the current brush color and / or effect. (Except for pick-color, which just changes the brush color)
To cancel a line, frame, box, circle or ring in progress, click RESET.

brush: click and drag to paint
lines: click to set the start point, click again to complete the line.
frames: click to draw a rectangle outline, as thick as the brush-width
boxes: click to draw a filled rectangle
fill: click to fill the selected solid-color region
fill-shades: like fill, but ignores shades of color.
doesn't work for all effects.
circles: draws a filled circle. click to specify center,
again to specify radius
rings: like circles, but draws a circular ring.
pick-color: click on the canvas to change the brush color to the
color of the selected patch
change-color: click on the canvas to change every patch with that color to the brush color


solid: draws in the selected color
dappled: draws in random shades of the selected color
center: changes the current patch color to the pure shade of that color,
except for grays, where darker gray becomes black and lighter gray becomes white
undapple: changes the current patch color to the pure shade of that color
darken: changes the current patch color to be slightly darker
lighten: changes the current patch color to be slightly lighter
blend: draws in the slected color, blended with the current patch color.
set the opacity with the strength slider.


Save : Save the patch colors (prompt for name)
Load : Load the patch colors (prompt for name)
Load!: Load the same file loaded last time (no prompt)

Enter the file-name (or path and file-name) when prompted.
If you want to use a file-extension, be sure to include it.

If the loaded image is larger than the current screen, you will be warned, the image will load, and the edges will be cut off.

If the loaded image is smaller, it will load into the center. The outer edges will not be cleared or otherwise changed.

reset: resets the drawing cursor and any marker turtles.
use to cancel a line, frame, box, circle, or ring in progress.

clear-cursors: clears the drawing cursor from the canvas,
so the canvas is clean for screen-shots and the like.
strength: specifies the diffusion strength, or the blend opacity
(stronger is more opaque)


shifters: shifts the patch colors in the indicated direction, by the amount of the shift slider
flip <-->: Flips the world along the center vertical axis
flip /\\/: Flips the world along the center horizontal axis
rotate: rotates the patches 90 degrees.
Caution: if the world is not square, color data in patches outside the center will be lost


undo-on?: enables or disables the undo feature
undo: removes the last change. For the brush tool, each stroke can be un-done individually
redo: reapplies the changes removed by undo.
clear-undo: deletes the undo-history
undo-levels: sets the maximum number of changes that can be recorded. Additional changes will cause the older



sample-solid: flashes the brush color on the canvas
sample-blend: flashes the brush color blended with the canvas
canvas: sets the canvas color
<=brush: sets the canvas color from the brush color
dapple-all: sets all patches to a random shade of their current color
breadth of shades determined by strength
0.0 = use pure color
0.5 = use mostly middle shades
1.0 = use all shades
posterize: sets all patches to their pure color.
shade-edges: sets color brightness based on number
of neighbors with same base-color
diffuse: performs diffusion at the specified strength
for the specified number of cycles

starburst: draws a sweep of lines around the center, in the current brush color and width,
cycles sets the spacing of the lines. Used with blend, darken, or lighten,
produces some attractive effects.


To interactively show the user the line, circle or box that will be drawn, "marker" turtles are created and destroyed. The number of marker turtles varies, depending on the screen-size.

To reduce the number of global variables, the model makes use of turtle variables and turtle inheritance.

The flood fill functions use recursion to fill the patches.

The model makes use of a turtle's ability to directly access the variables of the patch the turtle is on: The pointer turtle performs most of the tasks, so it can directly refer to the patch color, etc.

The model uses several custom-designed turtle-shapes as the various drawing cursors.

Where there are two reporters with nearly the same name, like "blend" and "blend?" the unadorned reporter refers to the brush color, whereas the "?" reporter always requires a color argument. For example: "dappled" reports a random shade of the brush color, but "dappled? red" reports a random shade of red.

Many of the effects depend on the base-color and tint reporters.
Base-color gives the black version of the color (i.e. the even multiple of 10 for the color)
E.g. the base-color of red (15) is 10.
Tint could also be called "shade": it gives the amount above the base-color. The tint of a pure color is alway 5. The tint of black is 0, the tint of white is 9.9999.

Black, white and gray are strange cases. They all share a base color (0) and therefore, the pure color (base + 5) of all three is 5. So, undapple will always turn black and white to gray. However, Center is a smarter undapple: It examines the shade of gray and turns darker gray to black and lighter gray to white.

Setting the size and shape every cycle caused the turtles to flicker. To avoid flicker of the cursors, the size and shape is tested first, and only set if it doesn't match. Likewise, the x and y coordinates are set only if the mouse moves to a different patch.

(back to the NetLogo User Community Models)