mojo.drawingTools
arc(center, radius, startAngle, endAngle, clockwise)
Add an arc with the given center
and radius
, from startAngle
to endAngle
, going clockwise if clockwise
is True
and counter-clockwise if clockwise
is False
.
curveTo(h1, h2, pt)
Add a curve segment to a given point (x,y)
with bezier handles at (h1x,h1y)
and (h2x,h2y)
.
fill(r=None, g=None, b=None, a=1)
Sets the fill color from red
, green
, blue
and alpha
values.
Each argument must be a float between 0 and 1.
font(fontName, fontSize=None)
Set a font with the given PostScript font name.
Optionally, a fontSize
can be set directly.
The default font, which is also used as fallback font, is LucidaGrande
.
The default fontSize
is 10pt.
image(pathOrImage, x, y=None, alpha=1)
Add an image from a path
with the given (x,y)
position and alpha
value.
Common file types such as pdf
, jpg
, png
, tiff
and gif
are supported.
Optionally, an alpha
transparency can be provided as a value between 0 and 1.
lineDash(*arg)
Sets a line dash with any given amount of lenghts. Uneven lenghts define the visible parts of the stroke, even lenghts the invisible.
polygon(xy, *args, **kwargs)
Draws a polygon by connecting the points in a given list.
Optionally, a close
argument (bool) can be provided to close or open the path.
By default, a polygon
is a closed path.
rotate(angle, center=None)
Rotate the canvas around the origin point with a given angle, in degrees.
roundedRect(x, y, width, height, radius)
Draw a rectangle with rounded corners with the given x
, y
, width
, height
and radius
.
scale(x=1, y=None, center=None)
Scale the canvas with the given x
(horizontal) and y
(vertical) scale factors.
If only 1 argument is provided, a proportional scale is applied.
The center of scaling can optionally be set via the center
keyword argument. By default this is the origin.
skew(angle1, angle2=0, center=None)
Skew the canvas with the given angles angle1
and angle2
, in degrees.
If only one argument is provided, a proportional skew is applied.
If only one argument is provided a proportional skew is applied.
The center of skewing can optionally be set via the center
keyword argument. By default this is the origin.
stroke(r=None, g=None, b=None, a=1)
Sets the stroke color from red
, green
, blue
and alpha
values.
Each argument must be a float between 0 and 1.
textBox(txt, xywh, align='left')
Draw a text into a given rectangular area.
The text box must be a (x,y,width,height)
tuple.
Optionally, a text alignment can be set.
Possible align
values are: left
, center
, right
and justified
.
The default alignment is left
.