Skip to content

Shape Functions

gaw1ik edited this page Oct 7, 2021 · 3 revisions

Below are the current set of basic shape functions in genartlayers.

~Note that the units for location (x,y) and dimensions (width, height, radius) are normalized to the artBoard dimensions. For example, x=0.5, y=0.5 will place a shape in the middle of the artBoard.

~fillMode is a value 0 (for fill) or 1 (for stroke)

~Ranges for color values are as follows...

Hue: 0-359

Saturation: 0-100

Lightness: 0-100

Alpha: 0-255

Rectangle

drawRect(x, y, width, height, lineWidth, hue, saturation, lightness, alpha, fillMode)

Circle

drawCircle(x, y, radius, lineWidth, hue, saturation, lightness, alpha, fillMode)

Ellipse

drawEllipse(x, y, radX, radY, rotation, lineWidth, hue, sat, lit, alpha, fillMode)

rotation is in radians.


Path

drawPath(path, lineWidth, hue, saturation, lightness, alpha, fillMode, close)

close is a 0 or 1 value, 1 being close and 0 being do not close.

path is of the form [ [x1,y1], [x2,y2], ... , [xN,yN] ]


Arc

drawArc(x, y, radX, radY, rotation, startAngle, endAngle, lineWidth, hue, sat, lit, alpha, fillMode) 

rotation, startAngle, and endAngle are in radians.


Text

drawText(text, x, y, fontSize, hue, sat, lit)

fontSize is in normalized units.


drawTextPix(text, x, y, fontSizePix, hue, sat, lit)

fontSize is in pixels (px).


Clone this wiki locally