|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgeomerative.RG
public class RG
RG is a static class containing all the states, modes, etc.. Most uses of Geomerative is done by calling RG methods. e.g. RShape s = RG.getEllipse(30, 40, 80, 80)
Nested Class Summary | |
---|---|
static class |
RG.FontNotLoadedException
|
static class |
RG.LibraryNotInitializedException
|
static class |
RG.NoPathInitializedException
|
Field Summary | |
---|---|
static int |
ADAPTATIVE
ADAPTATIVE segmentator minimizes the number of segments avoiding perceptual artifacts like angles or cusps. |
static int |
BYELEMENTINDEX
The adaptor adapts the shape to a particular shape by adapting each of the groups elements indices. |
static int |
BYELEMENTPOSITION
The adaptor adapts the shape to a particular shape by adapting each of the groups elements positions. |
static int |
BYPOINT
The adaptor adapts the shape to a particular shape by adapting each of the groups points. |
static boolean |
ignoreStyles
|
static int |
UNIFORMLENGTH
UNIFORMLENGTH segmentator is the slowest segmentator and it segments the curve on segments of equal length. |
static int |
UNIFORMSTEP
UNIFORMSTEP segmentator is the fastest segmentator and it segments the curve based on a constant value of the step of the curve parameter, or on the number of segments wanted. |
static boolean |
useFastClip
|
Fields inherited from interface processing.core.PConstants |
---|
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z |
Constructor Summary | |
---|---|
RG()
|
Method Summary | |
---|---|
static RShape |
adapt(RShape shp,
RShape path)
Adapt a shape along the curve of another shape. |
static void |
beginShape()
Begin to create a shape. |
static void |
bezierVertex(float cx1,
float cy1,
float cx2,
float cy2,
float x,
float y)
Add a bezierVertex to the shape. |
static void |
breakShape()
|
static void |
breakShape(int endMode)
Begin a new path in the current shape. |
static RShape |
centerIn(RShape grp,
processing.core.PGraphics g)
|
static RShape |
centerIn(RShape grp,
processing.core.PGraphics g,
float margin)
|
static RShape |
createShape(RPoint[][] points)
Create a shape from an array of point arrays. |
static RShape |
diff(RShape a,
RShape b)
Binary difference between two shapes. |
static void |
endShape()
|
static void |
endShape(processing.core.PGraphics g)
End the shape being created and draw it to the screen or the PGraphics passed as parameter. |
static RShape |
getEllipse(float x,
float y,
float w)
|
static RShape |
getEllipse(float x,
float y,
float w,
float h)
Get an ellipse as a shape object. |
static RShape |
getLine(float x1,
float y1,
float x2,
float y2)
Get a line as a shape object. |
static RShape |
getRect(float x,
float y,
float w)
|
static RShape |
getRect(float x,
float y,
float w,
float h)
Get an rectangle as a shape object. |
static RShape |
getRing(float x,
float y,
float widthBig,
float widthSmall)
Get a ring as a shape object. |
static RShape |
getShape()
End the shape being created and get it as an object. |
static RShape |
getStar(float x,
float y,
float widthBig,
float widthSmall,
int spikes)
Get a star as a shape object. |
static RShape |
getText(java.lang.String text)
|
static RShape |
getText(java.lang.String text,
java.lang.String font,
int size,
int align)
Get the shape corresponding to a text. |
static void |
ignoreStyles()
|
static void |
ignoreStyles(boolean value)
Ignore the styles of the shapes when drawing and use the processing style methods. |
static void |
init(processing.core.PApplet _parent)
Initialize the library. |
static boolean |
initialized()
|
static RShape |
intersection(RShape a,
RShape b)
Binary intersection between two shapes. |
static RFont |
loadFont(java.lang.String fontFile)
Load and get the font object that can be used in the textFont method. |
static RShape |
loadShape(java.lang.String filename)
Load a shape object from a file. |
static RShape |
polygonize(RShape shp)
Polygonize a shape. |
static void |
saveShape(java.lang.String filename,
RShape shape)
Save a shape object to a file. |
static void |
setAdaptor(int adptorType)
Use this to set the adaptor type. |
static void |
setAdaptorLengthOffset(float adptorLengthOffset)
Use this to set the adaptor length offset. |
static void |
setAdaptorScale(float adptorScale)
Use this to set the adaptor scaling. |
static void |
setPolygonizer(int segmenterMethod)
Use this to set the polygonizer type. |
static void |
setPolygonizerAngle(float angle)
Use this to set the segmentator angle tolerance for the ADAPTATIVE segmentator and set the segmentator to ADAPTATIVE. |
static void |
setPolygonizerLength(float length)
Use this to set the segmentator length for the UNIFORMLENGTH segmentator and set the segmentator to UNIFORMLENGTH. |
static void |
setPolygonizerStep(float step)
Use this to set the segmentator step for the UNIFORMSTEP segmentator and set the segmentator to UNIFORMSTEP. |
static void |
shape(RShape shp)
|
static void |
shape(RShape shp,
float x,
float y)
|
static void |
shape(RShape shp,
float x,
float y,
float w,
float h)
Draw a shape to a given position on the screen. |
static RShape[] |
split(RShape shp,
float t)
Split a shape along the curve length in two parts. |
static void |
text(java.lang.String text)
Draw text to the screen using the font set using the textFont method. |
static void |
textFont(RFont font,
int size)
Set the font object to be used in all text calls. |
static RShape |
union(RShape a,
RShape b)
Binary union between two shapes. |
static void |
vertex(float x,
float y)
Add a vertex to the shape. |
static RShape |
xor(RShape a,
RShape b)
Binary xor between two shapes. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean ignoreStyles
public static boolean useFastClip
public static final int BYPOINT
public static final int BYELEMENTPOSITION
public static final int BYELEMENTINDEX
public static int ADAPTATIVE
public static int UNIFORMLENGTH
public static int UNIFORMSTEP
Constructor Detail |
---|
public RG()
Method Detail |
---|
public static RFont loadFont(java.lang.String fontFile)
fontFile
- the filename of the font to be loaded
public static void text(java.lang.String text)
text
- the string to be drawn on the screenpublic static void textFont(RFont font, int size)
font
- the font object to be setsize
- the size of the fontpublic static RShape getText(java.lang.String text, java.lang.String font, int size, int align)
font
- the filename of the font to be loadedtext
- the string to be createdsize
- the size of the font to be usedalign
- the alignment. Use RG.CENTER, RG.LEFT or RG.RIGHT
public static RShape getText(java.lang.String text)
public static void shape(RShape shp, float x, float y, float w, float h)
shp
- the shape to be drawnx
- the horizontal coordinatey
- the vertical coordinatew
- the width with which we draw the shapeh
- the height with which we draw the shapepublic static void shape(RShape shp, float x, float y)
public static void shape(RShape shp)
public static RShape createShape(RPoint[][] points)
public static RShape loadShape(java.lang.String filename)
filename
- the SVG file to be loaded. Must be in the data directorypublic static void saveShape(java.lang.String filename, RShape shape)
filename
- the SVG file to be saved.shape
- the shape to be saved.public static void beginShape()
public static void breakShape(int endMode)
endMode
- if called with RG.CLOSE it closes the current path before starting the new one.public static void breakShape()
public static void vertex(float x, float y)
x
- the x coordinate of the vertexy
- the y coordinate of the vertexpublic static void bezierVertex(float cx1, float cy1, float cx2, float cy2, float x, float y)
cx1
- the x coordinate of the first control pointcy1
- the y coordinate of the first control pointcx2
- the x coordinate of the second control pointcy2
- the y coordinate of the second control pointx
- the x coordinate of the end pointy
- the y coordinate of the end pointpublic static void endShape(processing.core.PGraphics g)
g
- the canvas on which to draw. By default it draws on the screenpublic static void endShape()
public static RShape getShape()
public static RShape getEllipse(float x, float y, float w, float h)
x
- x coordinate of the center of the shapey
- y coordinate of the center of the shapew
- width of the ellipseh
- height of the ellipse
public static RShape getEllipse(float x, float y, float w)
public static RShape getLine(float x1, float y1, float x2, float y2)
x1
- x coordinate of the first point of the liney1
- y coordinate of the first point of the linex2
- x coordinate of the last point of the liney2
- y coordinate of the last point of the line
public static RShape getRect(float x, float y, float w, float h)
x
- x coordinate of the top left corner of the shapey
- y coordinate of the top left of the shapew
- width of the rectangleh
- height of the rectangle
public static RShape getRect(float x, float y, float w)
public static RShape getStar(float x, float y, float widthBig, float widthSmall, int spikes)
x
- x coordinate of the center of the shapey
- y coordinate of the center of the shapewidthBig
- the outter width of the star polygonwidthSmall
- the inner width of the star polygonspikes
- the amount of spikes on the star polygon
public static RShape getRing(float x, float y, float widthBig, float widthSmall)
x
- x coordinate of the center of the shapey
- y coordinate of the center of the shapewidthBig
- the outter width of the ring polygonwidthSmall
- the inner width of the ring polygon
public static RShape centerIn(RShape grp, processing.core.PGraphics g, float margin)
public static RShape centerIn(RShape grp, processing.core.PGraphics g)
public static RShape[] split(RShape shp, float t)
shp
- the shape to be splitedt
- the proportion (a value from 0 to 1) along the curve where to split
public static RShape adapt(RShape shp, RShape path)
shp
- the shape to be adaptedpath
- the shape which curve will be followed
public static RShape polygonize(RShape shp)
shp
- the shape to be polygonized
public static void init(processing.core.PApplet _parent)
public static boolean initialized()
public static RShape diff(RShape a, RShape b)
a
- first shape to operate onb
- second shape to operate on
public static RShape union(RShape a, RShape b)
a
- first shape to operate onb
- second shape to operate on
public static RShape intersection(RShape a, RShape b)
a
- first shape to operate onb
- second shape to operate on
public static RShape xor(RShape a, RShape b)
a
- first shape to operate onb
- second shape to operate on
public static void ignoreStyles(boolean value)
value
- value to which the ignoreStyles state should be setpublic static void ignoreStyles()
public static void setAdaptor(int adptorType)
adptorType
- it can be RG.BYPOINT, RG.BYELEMENTPOSITION or RG.BYELEMENTINDEXpublic static void setAdaptorScale(float adptorScale)
adptorScale
- the scaling coefficientpublic static void setAdaptorLengthOffset(float adptorLengthOffset) throws java.lang.RuntimeException
adptorLengthOffset
- the offset along the curve of the shape. Must be a value between 0 and 1;
java.lang.RuntimeException
public static void setPolygonizer(int segmenterMethod)
segmenterMethod
- can be RG.ADAPTATIVE, RG.UNIFORMLENGTH or RG.UNIFORMSTEP.public static void setPolygonizerAngle(float angle)
angle
- an angle from 0 to PI/2 it defines the maximum angle between segments.public static void setPolygonizerLength(float length)
length
- the length of each resulting segment.public static void setPolygonizerStep(float step)
step
- if a float from +0.0 to 1.0 is passed it's considered as the step, else it's considered as the number of steps. When a value of 0.0 is used the steps will be calculated automatically depending on an estimation of the length of the curve. The special value -1 is the same as 0.0 but also turning of the segmentation of lines (faster segmentation).
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |