Node:Drawing objects, Next:, Previous:Drawing on canvas, Up:canvas



Drawing objects

The canvas object can be invoked manually to draw variety of things if you desire so.

canvas.T:line LINESTYLE, X1, Y1, X2, Y2 Method

# draw a line segment from (10,20) to (100, 200)
can.line(line_style.blackdash1, 10, 20, 100, 200)

canvas.line LINESTYLE, X1, Y1, X2, Y2 Function
Calls the method with the same name on the default canvas object.

canvas.T:polygon LINESTYLE, FILLSTYLE, [(X1,Y1), ..., (Xn, Yn)] Method

Draw a polygon with LINESTYLE (see line_style), fill with FILLSTYLE (see fill_style), and the edges POINTS. POINTS is a list of coordinates, e.g., ((10,10), (15,5), (20,8)). SHADOW is either None or a tuple (XDELTA, YDELTA, SHADOWSTYLE). If non-null, a shadow of SHADOWSTYLE (see fill_style)is drawn beneath the polygon at the offset of (XDELTA, YDELTA). LINESTYLE can be None, in which case no perimeter lines are drawn. FILLSTYLE (see fill_style) can also be None, in which the internal of the polygon are left undrawn.

can.polygon(line_style.default, fill_style.default,
               [(10, 20), (100, 200), (300,300)])

canvas.polygon LINESTYLE, FILLSTYLE, [(X1,Y1), ..., (Xn, Yn)] Function
Calls the method with the same name on the default canvas object.

canvas.T:rectangle LINESTYLE, FILLSTYLE, X1, Y1, X2, Y2, SHADOW=None Method

Parameter shadow, if none, draws a drop-shadow. It should be a tuple of three values, (x_off, y_off, fill).

can.rectangle(line_style.default, fill_style.default,
                 10, 20, 300, 300)

canvas.rectangle LINESTYLE, FILLSTYLE, X1, Y1, X2, Y2, SHADOW=None Function
Calls the method with the same name on the default canvas object.

canvas.T:ellipsis LINESTYLE, FILLSTYLE, X, Y, RADIUS, Y-ELONGATION=1, START=0, END=360, SHADOW=None Method

The start and end angles are specified in degrees; i.e., between 0 and 360. Parameter shadow, if none, draws a drop-shadow. It should be a tuple of three values, (x_off, y_off, fill).

canvas.ellipsis LINESTYLE, FILLSTYLE, X, Y, RADIUS, Y-ELONGATION=1, START=0, END=360, SHADOW=None Function
Calls the method with the same name on the default canvas object.

canvas.T:round_rectangle LINESTYLE, FILLSTYLE, X1,Y2,X2,Y2,RADIUS,SHADOW=None Method
Draw a rectangle with rounded four corners.

Parameter shadow, if none, draws a drop-shadow. It should be a tuple of three values, (x_off, y_off, fill).

canvas.round_rectangle LINESTYLE, FILLSTYLE, X1,Y2,X2,Y2,RADIUS,SHADOW=None Function
Calls the method with the same name on the default canvas object.

canvas.T:curve LINESTYLE, [(X1,Y2), ..., (Xn, Yn)] Method
Draw a Bezier curve.

canvas.curve LINESTYLE, [(X1,Y2), ..., (Xn, Yn)] Function
Calls the method with the same name on the default canvas object.

canvas.T:show X, Y, TEXT Method
TEXT supports font manipulation, as defined in See font.

canvas.show X, Y, TEXT Function
Calls the method with the same name on the default canvas object.

canvas.T:verbatim STR Method
This procedure outputs an arbitrary text STR to the file.

canvas.verbatim STR Function
Calls the method with the same name on the default canvas object.

canvas.default_canvas Function
Return the default canvas.