from mojo.drawingTools import *

Using similar tools to draw in Cocoa object like DrawBot. (see TinyDrawBot extension)

  • save()
    save the current graphic state 
  • restore()
    restore the current graphic state 
  • rect(x, y, width, height)
    draws a rectangle 
  • oval(x, y, width, height)
    draws an oval 
  • newPath()
    creates a new path 
  • moveTo((x, y))
    move to point
  • lineTo((x, y))
    line to point
  • curveTo((h1x, h1y), (h2x, h2y), (x, y))
    curve to point with bcps
  • closePath()
    close the path
  • drawPath()
    draws the path
  • fill(r, g, b, a=1)
    Set the fill color as RGB value.
  • stroke(r, g, b, a=1)
    Set the stroke color as RGB value.
  • strokeWidth(value)
    Set the stroke width for a path.
  • miterLimit(value)
    Set the miter limit for a path.
  • lineJoin(join)
    Set the line join for a path, possible join arguments are: "bevel", "miter" or "round"
  • dashLine(dash)
    dash is a list of of values 
  • translate(x, y)
    Translate the art board pane to "x", "y" 
  • rotate(angle)
    Rotate the art board by an angle.
  • scale(x, y)
    Scale the art board by "x", "y", if "y" is not set the art board will be scaled proportionally.
  • skew(a, b)
    Skew the art board by "a", "b", if "b" is not set the art board will be skew with "a" = "b"
  • font(fontName, fontSize=None)
    Set the font by PostScript name.
    Optionally set the font size. 
  • fontSize(fontSize)
    Set the font size.
  • text(textString, (x, y))
    Draw a text on position "x", "y".
  • image(filePath, (x, y), alpha=1)
    Draw an image on position "x", "y".
    Optionally set an alpha value.