drawbotscreen.jpg

LettError
RoboFab
Processing
Python
PyObjC

Copyright
2003-2008
DrawBot

Reference

Canvas

The canvas is the thing DrawBot draws on. It's the document size, the art board. It has a height and a width which can be set. The dimensions of the canvas are not related to the size of the window.

The origin of the drawing board is at the bottom left.

orientation.jpg

size(w, h)

set the width and height of the canvas. You can call size() only once in a script. Without calling size() the default drawing board is 1000 by 1000 points.

# canvas example

# a drawing board of 100 by 100 points.
size(100, 100)

HEIGHT and WIDTH

If you want to use the height and width of the canvas in a calculation, you can call the magic variables HEIGHT and WIDTH.

# canvas example

# a drawing board of 200 by 500 points.
size(200, 500)

print HEIGHT
>>> 500

print WIDTH
>>> 200