Module draw2D

Draw2D: simple drawing primitives for 2D graphics

Functions

push () Store the current transformation until the next pop() Caches the current transform matrix into the matrix stack, and pushes a new copy of the matrix onto the top.
pop () Restore the transformation from the previous push() Discards the current transformation matrix and restores the previous matrix from the matrix stack.
translate (x, y) Move the coordinate system origin to x, y (modifies the transformation matrix)
scale (x, y) Scale the coordinate system (modifies the transformation matrix)
rotate (a) Rotate the coordinate system around the origin (modifies the transformation matrix)
point (x, y) Draw a point at position x,y
line (x1, y1, x2, y2) Draw a line from x1,y1 to x2,y2
rect (x, y, w, h) Draw a rectangle at the point (x, y) with width w and height h
ellipse (x, y, w, h) Draw an ellipse at the point (x, y) with horizontal diameter w and vertical diameter h
circle (x, y, d) Draw an ellipse at the point (x, y) with horizontal diameter d
arc (x, y, s, e, w, h) Draw an arc at the point (x, y) with horizontal diameter d
color (red, green, blue, alpha) Set the rendering color


Functions

push ()
Store the current transformation until the next pop() Caches the current transform matrix into the matrix stack, and pushes a new copy of the matrix onto the top. Note that the stack is limited in size (typically 32 items).
pop ()
Restore the transformation from the previous push() Discards the current transformation matrix and restores the previous matrix from the matrix stack.
translate (x, y)
Move the coordinate system origin to x, y (modifies the transformation matrix)

Parameters:

  • x coordinate of new origin
  • y coordinate of new origin
scale (x, y)
Scale the coordinate system (modifies the transformation matrix)

Parameters:

  • x horizontal factor
  • y vertical factor
rotate (a)
Rotate the coordinate system around the origin (modifies the transformation matrix)

Parameters:

  • a the angle (in radians) to rotate
point (x, y)
Draw a point at position x,y

Parameters:

  • x coordinate of center (optional, defaults to 0)
  • y coordinate of center (optional, defaults to 0)
line (x1, y1, x2, y2)
Draw a line from x1,y1 to x2,y2

Parameters:

  • x1 start coordinate
  • y1 start coordinate
  • x2 end coordinate (optional, defaults to 0)
  • y2 end coordinate (optional, defaults to 0)
rect (x, y, w, h)
Draw a rectangle at the point (x, y) with width w and height h

Parameters:

  • x coordinate of center (optional, defaults to 0)
  • y coordinate of center (optional, defaults to 0)
  • w width (optional, defaults to 1)
  • h height (optional, defaults to 1)
ellipse (x, y, w, h)
Draw an ellipse at the point (x, y) with horizontal diameter w and vertical diameter h

Parameters:

  • x coordinate of center (optional, defaults to 0)
  • y coordinate of center (optional, defaults to 0)
  • w horizontal diameter (optional, defaults to 1)
  • h vertical diameter (optional, defaults to w)
circle (x, y, d)
Draw an ellipse at the point (x, y) with horizontal diameter d

Parameters:

  • x coordinate of center (optional, defaults to 0)
  • y coordinate of center (optional, defaults to 0)
  • d diameter (optional, defaults to 1)
arc (x, y, s, e, w, h)
Draw an arc at the point (x, y) with horizontal diameter d

Parameters:

  • x coordinate of center (optional, defaults to 0)
  • y coordinate of center (optional, defaults to 0)
  • s start angle (optional, defaults to -pi/2)
  • e end angle (optional, defaults to pi/2)
  • w horizontal radius (optional, defaults to 1)
  • h vertical radius (optional, defaults to w)
color (red, green, blue, alpha)
Set the rendering color

Parameters:

  • red value from 0 to 1 (optional, default 0)
  • green value from 0 to 1 (optional, default 0)
  • blue value from 0 to 1 (optional, default 0)
  • alpha (opacity) value from 0 to 1 (optional, default 1)
generated by LDoc 1.3