|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gicentre.handy.HandyRenderer
public class HandyRenderer
The renderer that draws graphic primitives in a sketchy style. The style of sketchiness can be configured in this class. Based on an original idea by Nikolaus Gradwohl
Constructor Summary | |
---|---|
HandyRenderer(processing.core.PApplet parent)
|
Method Summary | |
---|---|
void |
arc(float x,
float y,
float width,
float height,
float start,
float stop)
Draws an arc along the outer edge of an ellipse defined by the x,y, width and height parameters. |
void |
beginShape()
Starts a new shape of type POLYGON . |
void |
beginShape(int mode)
Starts a new shape of the type specified in the mode parameter. |
void |
ellipse(float x,
float y,
float w,
float h)
Draws an ellipse using the given location and dimensions. |
void |
endShape()
Ends a shape definition. |
void |
endShape(int mode)
Ends a shape definition. |
void |
line(float x1,
float y1,
float x2,
float y2)
Draws a 2D line between the given coordinate pairs. |
void |
point(float x,
float y)
Draws point at the given location. |
void |
polyLine(float[] xCoords,
float[] yCoords)
Draws a complex line that links the given coordinates. |
void |
quad(float x1,
float y1,
float x2,
float y2,
float x3,
float y3,
float x4,
float y4)
Draws a quadrilateral shape. |
void |
rect(float x,
float y,
float w,
float h)
Draws a rectangle using the given location and dimensions. |
void |
resetStyles()
Resets the sketchy styles to default values. |
void |
setBackgroundColour(int colour)
Sets the background colour for closed shapes. |
void |
setFillColour(int colour)
Sets the fill colour for closed shapes. |
void |
setFillGap(float gap)
Determines the gap between fill lines. |
void |
setFillWeight(float weight)
Determines the thickness of fill lines. |
void |
setGraphics(processing.core.PGraphics graphics)
Sets the the graphics context into which all output is directed. |
void |
setHachureAngle(float degrees)
Sets the angle for shading hachures. |
void |
setHachurePerturbationAngle(float degrees)
Sets the maximum random perturbation in hachure angle per object. |
void |
setIsAlternating(boolean alternate)
Determines whether or not an alternating fill stroke is used to shade shapes. |
void |
setIsHandy(boolean isHandy)
Determines whether or not the renderer applies a hand-drawn sketchy appearance. |
void |
setOverrideFillColour(boolean override)
Determines whether or not to override the fill colour that would otherwise be determined by the sketch's fillColor setting. |
void |
setOverrideStrokeColour(boolean override)
Determines whether or not to override the stroke colour that would otherwise be determined by the sketch's strokeColor setting. |
void |
setRoughness(float roughness)
Sets the general roughness of the sketch. |
void |
setSecondaryColour(int colour)
Sets the secondary colour for line filling. |
void |
setSeed(long seed)
Sets the seed used for random offsets when drawing. |
void |
setStrokeColour(int colour)
Sets the stroke colour for rendering features. |
void |
setStrokeWeight(float weight)
Determines the thickness of outer lines. |
void |
setUseSecondaryColour(boolean useSecondary)
Determines whether or not a secondary colour is used for filling lines. |
void |
shape(float[] xCoords,
float[] yCoords)
Draws a closed polygon shape based on the given arrays of vertices. |
void |
shape(float[] xCoords,
float[] yCoords,
boolean closeShape)
Draws a polygon shape based on the given arrays of vertices. |
static float[] |
toArray(java.util.List<java.lang.Float> list)
Converts an array list of numeric values into a floating point array. |
void |
triangle(float x1,
float y1,
float x2,
float y2,
float x3,
float y3)
Draws a triangle through the three pairs of coordinates. |
void |
vertex(float x,
float y)
Adds a vertex to a shape that was started with a call to beginShape()
or one of its variants. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HandyRenderer(processing.core.PApplet parent)
Method Detail |
---|
public void setGraphics(processing.core.PGraphics graphics)
graphics
- New graphics context in which to render.public void setSeed(long seed)
seed
- Random number seed. This can be any whole number, generating the same random variation
in rendering on each redraw.public void setIsHandy(boolean isHandy)
isHandy
- Sketchy appearance used if true, or normal Processing appearance if false.public void setHachureAngle(float degrees)
degrees
- Angle of hachures in degrees where 0 is vertical, 45 is NE-SW and 90 is horizontal.public void setHachurePerturbationAngle(float degrees)
degrees
- Maximum hachure perturbation angle.public void setBackgroundColour(int colour)
colour
- Background colour.public void setFillColour(int colour)
setOverrideFillColour()
is true.
colour
- Fill colour to use.public void setOverrideFillColour(boolean override)
fillColor
setting. If overridden, the colour is instead chosen from the
value last provided to setFillColour()
.
override
- If true the interior colour of features is determined by setFillColour
,
if not, it is determined by the parent sketch's fill colour setting.public void setStrokeColour(int colour)
setOverrideStrokeColour()
is true.
colour
- Stroke colour to use.public void setOverrideStrokeColour(boolean override)
strokeColor
setting. If overridden, the colour is instead chosen from the
value last provided to setStrokeColour()
.
override
- If true the stroke colour of features is determined by setStrokeColour
,
if not, it is determined by the parent sketch's stroke colour setting.public void setUseSecondaryColour(boolean useSecondary)
useSecondary
- If true a secondary colour is used.public void setSecondaryColour(int colour)
setUseSecondaryColour()
is true.
colour
- Colour to tint line filling.public void setFillWeight(float weight)
weight
- Fill weight in pixel units. If zero or negative, fill weight is based on the sketch's strokeWeight setting.public void setStrokeWeight(float weight)
weight
- Stroke weight in pixel units. If zero or negative, stroke weight is based on the sketch's strokeWeight setting.public void setFillGap(float gap)
gap
- Gap between fill lines in pixel units. If zero, solid fill used; if negative, gap based on strokeWeight setting.public void setIsAlternating(boolean alternate)
alternate
- Zig-zag filling used if true, parallel lines if not.public void setRoughness(float roughness)
roughness
- The sketchiness of the rendering. The larger the number the more sketchy the rendering.public void resetStyles()
public void point(float x, float y)
x
- x coordinate of the point.y
- y coordinate of the point.public void ellipse(float x, float y, float w, float h)
x
- x coordinate of the ellipse's positiony
- y coordinate of the ellipse's position.w
- Width of the ellipse (but see modifications possible with ellipseMode())h
- Height of the ellipse (but see modifications possible with ellipseMode())public void rect(float x, float y, float w, float h)
x
- x coordinate of the rectangle positiony
- y coordinate of the rectangle position.w
- Width of the rectangle (but see modifications possible with rectMode())h
- Height of the rectangle (but see modifications possible with rectMode())public void triangle(float x1, float y1, float x2, float y2, float x3, float y3)
x1
- x coordinate of the first triangle vertex.y1
- y coordinate of the first triangle vertex.x2
- x coordinate of the second triangle vertex.y2
- y coordinate of the second triangle vertex.x3
- x coordinate of the third triangle vertex.y3
- y coordinate of the third triangle vertex.public void quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
x1
- x coordinate of the first quadrilateral vertex.y1
- y coordinate of the first quadrilateral vertex.x2
- x coordinate of the second quadrilateral vertex.y2
- y coordinate of the second quadrilateral vertex.x3
- x coordinate of the third quadrilateral vertex.y3
- y coordinate of the third quadrilateral vertex.x4
- x coordinate of the fourth quadrilateral vertex.y4
- y coordinate of the fourth quadrilateral vertex.public void arc(float x, float y, float width, float height, float start, float stop)
x
- x coordinate of the start of the line.y
- y coordinate of the start of the line.width
- x coordinate of the end of the line.height
- y coordinate of the end of the line.start
- Angle to start the arc in radians.stop
- Angle to stop the arc in radians.public void beginShape()
POLYGON
. This must be paired with a call to
endShape()
or one of its variants.
public void beginShape(int mode)
endShape()
or one of its variants.
mode
- either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIPpublic void vertex(float x, float y)
beginShape()
or one of its variants.
x
- x coordinate of vertex to add.y
- y coordinate of vertex to add.public void endShape()
beginShape()
or one of its variants. Note that this version will not close the shape if the last vertex does
not match the first one.
public void endShape(int mode)
beginShape()
or one of its variants. If the mode parameter CLOSE
the shape will be closed.
public void shape(float[] xCoords, float[] yCoords)
xCoords
- x coordinates of the shape.yCoords
- y coordinates of the shape.public void shape(float[] xCoords, float[] yCoords, boolean closeShape)
xCoords
- x coordinates of the shape.yCoords
- y coordinates of the shape.closeShape
- Boundary of shape will be closed if true.public void polyLine(float[] xCoords, float[] yCoords)
xCoords
- x coordinates of the line.yCoords
- y coordinates of the line.public void line(float x1, float y1, float x2, float y2)
x1
- x coordinate of the start of the line.y1
- y coordinate of the start of the line.x2
- x coordinate of the end of the line.y2
- y coordinate of the end of the line.public static float[] toArray(java.util.List<java.lang.Float> list)
list
- List of numbers to convert.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |