# set the canvas size size(w, h) # get the canvas size through these "magic" # variables: print WIDTH print HEIGHT # draw a rect rect(x, y, w, h) # draw an oval oval(x, y, w, h) # draw a polygon polygon(x1, y1, x2, y2, x3, y3, ...) # set the current fill color fill(r, g, b) fill(r, g, b, alpha) fill(grayvalue) fill(None) # no fill color # set the current stroke color stroke(r, g, b) stroke(r, g, b, alpha) stroke(grayvalue) stroke(None) # no stroke color # set the stroke thickness strokewidth(w) # create Bezier paths newpath() moveto(x, y) lineto(x, y) # curvetoparameters: # first control point (x1, y1) # second control point (x2, y2) # end point (x3, y3) curveto(x1, y1, x2, y2, x3, y3) arcto(x1, y1, x2, y2, radius) closepath() drawpath() linecap(...) linejoin(...) miterlimit(...) translate(dx, dy) scale(scale) scale(xscale, yscale) rotate(angleInDegrees) rotate(radians=angleInRadians) skew(x, y) save() restore() # path points to an image file, such as .jpg # .gif, .png, .pdf, .tiff image(path, x, y) image(path, x, y, alpha) # Text! font(fontname) fontsize(size) text(atext, x, y)