public class Draw extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Draw.Compound
Combines several different DrawCommands into a single command.
|
static class |
Draw.Ellipse
Draws an ellipse.
|
static class |
Draw.Forward
Draw a line by a specified amount and translate to the end of that line.
|
static class |
Draw.Line
Draws a line from (x1, y1) to (x2, y2).
|
static class |
Draw.Noop
Do nothing.
|
static class |
Draw.Pop
Pop a transformation matrix of the draw context from the stack.
|
static class |
Draw.Push
Push the current transformation matrix of the draw context to the stack.
|
static class |
Draw.Rect
Draws a rectangle.
|
static class |
Draw.Rotate
Rotate the drawing context by the specified amount.
|
static class |
Draw.Translate
Translates the drawing context.
|
Modifier and Type | Field and Description |
---|---|
static Draw.Noop |
NOOP
NOOP is useful for instructions that are to be ignored, i.e.
|
Constructor and Description |
---|
Draw() |
Modifier and Type | Method and Description |
---|---|
static Draw.Compound |
c(DrawCommand... commands)
Shorthand to combine multiple DrawCommands into a single command.
|
static Draw.Ellipse |
ellipse(float x,
float y,
float w,
float h)
Make a new Ellipse.
|
static Draw.Forward |
forward(float drawLength)
Make a new Forward.
|
static Draw.Line |
line(float x1,
float y1,
float x2,
float y2)
Make a new Line.
|
static Draw.Pop |
pop()
Make a new Pop command.
|
static Draw.Push |
push()
Make a new Push command.
|
static Draw.Rect |
rect(float x,
float y,
float w,
float h)
Make a new Rect.
|
static Draw.Rotate |
rotate(float theta)
Make a new Rotate.
|
static Draw.Translate |
translate(float x,
float y)
Make a new Translate.
|
public static final Draw.Noop NOOP
public static Draw.Line line(float x1, float y1, float x2, float y2)
x1
- x-coordinate of first pointy1
- y-coordinate of first pointx2
- x-coordinate of second pointy2
- y-coordinate of first pointpublic static Draw.Rect rect(float x, float y, float w, float h)
x
- the x-coordinate of upper-left cornery
- the y-coordinate of upper-left cornerw
- the width of the rectangleh
- the height of the rectanglepublic static Draw.Ellipse ellipse(float x, float y, float w, float h)
x
- the x-coordinate of the centery
- the y-coordinate of the centerw
- the length of the horizontal axish
- the length of the vertical axispublic static Draw.Translate translate(float x, float y)
x
- the amount to translate horizontally in pixelsy
- the amount to translate vertically in pixelspublic static Draw.Forward forward(float drawLength)
drawLength
- the amount to draw/move forwardpublic static Draw.Rotate rotate(float theta)
theta
- the amount to rotate by in radianspublic static Draw.Push push()
public static Draw.Pop pop()
public static Draw.Compound c(DrawCommand... commands)
commands
- the DrawCommands to be combinedProcessing Library loom by Cora Johnson-Roberson. (c) 2014-2016