org.gicentre.handy
Class HandyDraw

java.lang.Object
  extended by processing.core.PImage
      extended by processing.core.PGraphics
          extended by processing.core.PGraphics2D
              extended by org.gicentre.handy.HandyDraw
All Implemented Interfaces:
java.lang.Cloneable, processing.core.PConstants

public class HandyDraw
extends processing.core.PGraphics2D

Wrapper around a HandyRenderer that allows Handy drawing to be turned on or off inside a sketch without having to change any of the sketch's drawing commands. To use, put the drawing code between calls to startHandy() and stopHandy() in a sketch.

Version:
1.0, 28th January, 2012.
Author:
Aidan Slingsby and Jo Wood, giCentre, City University London.

Field Summary
 
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, autoNormal, backgroundA, backgroundAi, backgroundAlpha, backgroundB, backgroundBi, backgroundColor, backgroundG, backgroundGi, backgroundR, backgroundRi, bezierBasisInverse, bezierBasisMatrix, bezierDetail, bezierDrawMatrix, bezierInited, calcA, calcAi, calcAlpha, calcB, calcBi, calcColor, calcG, calcGi, calcR, calcRi, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, cosLUT, curveBasisMatrix, curveDetail, curveDrawMatrix, curveInited, curveTightness, curveToBezierMatrix, curveVertexCount, curveVertices, DEFAULT_STROKE_CAP, DEFAULT_STROKE_JOIN, DEFAULT_STROKE_WEIGHT, DEFAULT_VERTICES, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillA, fillAi, fillAlpha, fillB, fillBi, fillColor, fillG, fillGi, fillR, fillRi, height1, hints, image, imageMode, NORMAL_MODE_AUTO, NORMAL_MODE_SHAPE, NORMAL_MODE_VERTEX, normalMode, normalX, normalY, normalZ, path, pixelCount, primarySurface, raw, rectMode, settingsInited, shape, shapeMode, shininess, SINCOS_LENGTH, SINCOS_PRECISION, sinLUT, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeA, strokeAi, strokeAlpha, strokeB, strokeBi, strokeCap, strokeColor, strokeG, strokeGi, strokeJoin, strokeR, strokeRi, strokeWeight, textAlign, textAlignY, textBreakCount, textBreakStart, textBreakStop, textBuffer, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, textWidthBuffer, textX, textY, textZ, tint, tintA, tintAi, tintAlpha, tintB, tintBi, tintColor, tintG, tintGi, tintR, tintRi, vertexCount, vertices, warnings, width1
 
Fields inherited from class processing.core.PImage
cacheMap, format, height, modified, mx1, mx2, my1, my2, paramMap, parent, pixels, saveImageFormats, width
 
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, BILINEAR, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLAMP, 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_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, DYNAMIC, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_MASK, 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, FIXED, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HAS_NORMAL, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINEAR, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, OPENGL2, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINT_SPRITES, POINTS, POLYGON, POSTERIZE, PROBLEM, PROG_GL2, PROG_GL3, PROG_GL4, PROJECT, PROJECTION, QUAD, QUAD_STRIP, QUADRATIC, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, STATIC, STREAM, SUBTRACT, SW, TAB, TARGA, TEXT, TEXTURE2D, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TRILINEAR, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
HandyDraw(processing.core.PApplet sketch)
           
 
Method Summary
 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 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 startHandy()
          Turns on handy rendering.
 void stopHandy()
          Turns off handy rendering.
 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)
           
 
Methods inherited from class processing.core.PGraphics2D
allocate, applyMatrix, applyMatrix, arcImpl, backgroundImpl, beginDraw, bezier, box, box, breakShape, canDraw, concaveRender, curve, ellipseImpl, endDraw, imageImpl, point, popMatrix, printMatrix, pushMatrix, rectImpl, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, screenX, screenY, skewX, skewY, sphere, sphereDetail, sphereDetail, translate, translate, vertex, vertex
 
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, ambientFromCalc, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, arc, autoNormal, background, background, background, background, background, background, background, backgroundFromCalc, backgroundImpl, beginCamera, beginRaw, beginRecord, beginText, bezier, bezierDetail, bezierInit, bezierInitCheck, bezierPoint, bezierTangent, bezierVertex, bezierVertex, bezierVertexCheck, blue, brightness, camera, camera, checkSettings, color, color, color, color, color, color, color, color, color, colorCalc, colorCalc, colorCalc, colorCalc, colorCalc, colorCalc, colorCalcARGB, colorMode, colorMode, colorMode, colorMode, createShape, curve, curveDetail, curveInit, curveInitCheck, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, curveVertexCheck, curveVertexSegment, curveVertexSegment, defaultFontOrDeath, defaultFontOrDeath, defaultSettings, directionalLight, displayable, dispose, edge, ellipseMode, emissive, emissive, emissive, emissiveFromCalc, endCamera, endRaw, endRecord, endText, fill, fill, fill, fill, fill, fill, fillFromCalc, flush, frustum, getMatrix, getMatrix, getMatrix, getStyle, getStyle, getSupportedShapeFormats, green, hint, hintEnabled, hue, image, image, image, imageMode, is2D, is3D, isRecording, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, loadShape, matrixMode, mergeShapes, modelX, modelY, modelZ, noFill, noLights, normal, noSmooth, noStroke, noTexture, noTint, ortho, ortho, ortho, perspective, perspective, point, pointLight, popStyle, printCamera, printProjection, pushStyle, quadVertex, quadVertex, reapplySettings, rect, rect, rectImpl, rectImpl, rectMode, red, saturation, screenBlend, screenX, screenY, screenZ, setMatrix, setMatrix, setMatrix, setParent, setPath, setPrimary, setSize, shape, shape, shape, shapeMode, shapeName, shearX, shearY, shininess, showDepthWarning, showDepthWarningXYZ, showException, showMethodWarning, showMissingWarning, showVariationWarning, showWarning, smooth, specular, specular, specular, specularFromCalc, splineForward, spotLight, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeFromCalc, strokeJoin, strokeWeight, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textCharImpl, textCharModelImpl, textCharScreenImpl, textDescent, textFont, textFont, textLeading, textLineAlignImpl, textLineImpl, textMode, textModeCheck, textSentence, textSentenceBreak, textSize, texture, texture, textureBlend, textureMode, textWidth, textWidth, textWidth, textWidthImpl, tint, tint, tint, tint, tint, tint, tintFromCalc, vertex, vertex, vertexCheck, vertexFields, vertexTexture
 
Methods inherited from class processing.core.PImage
blend, blend, blendColor, blurAlpha, blurARGB, blurRGB, buildBlurKernel, checkAlpha, clone, copy, copy, delete, dilate, filter, filter, get, get, get, getCache, getImage, getImpl, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, getParams, init, isModified, loadPixels, loadTIFF, mask, mask, removeCache, removeParams, resize, save, saveImageIO, saveTGA, saveTIFF, set, set, setCache, setImpl, setModified, setModified, setParams, updatePixels, updatePixels, updatePixelsImpl
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandyDraw

public HandyDraw(processing.core.PApplet sketch)
Method Detail

startHandy

public void startHandy()
Turns on handy rendering. This should be paired with a call to stopHandy() once sketchy rendering is complete.


stopHandy

public void stopHandy()
Turns off handy rendering. This should be paired with a call to startHandy() before any drawing that needs to be in a sketchy style.


line

public void line(float x1,
                 float y1,
                 float x2,
                 float y2)
Draws a 2D line between the given coordinate pairs.

Overrides:
line in class processing.core.PGraphics
Parameters:
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.

ellipse

public void ellipse(float x,
                    float y,
                    float w,
                    float h)
Draws an ellipse using the given location and dimensions. By default the x,y coordinates will be centre of the ellipse, but the meanings of these parameters can be changed with Processing's ellipseMode() command.

Overrides:
ellipse in class processing.core.PGraphics
Parameters:
x - x coordinate of the ellipse's position
y - 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())

quad

public void quad(float x1,
                 float y1,
                 float x2,
                 float y2,
                 float x3,
                 float y3,
                 float x4,
                 float y4)
Draws a quadrilateral shape. Similar to a rectangle but angles not constrained to 90 degrees. Coordinates can proceed in either a clockwise or anti-clockwise direction.

Overrides:
quad in class processing.core.PGraphics
Parameters:
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.

rect

public void rect(float x,
                 float y,
                 float w,
                 float h)
Draws a rectangle using the given location and dimensions. By default the x,y coordinates will be the top left of the rectangle, but the meanings of these parameters can be changed with Processing's rectMode() command.

Overrides:
rect in class processing.core.PGraphics
Parameters:
x - x coordinate of the rectangle position
y - 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())

triangle

public void triangle(float x1,
                     float y1,
                     float x2,
                     float y2,
                     float x3,
                     float y3)
Draws a triangle through the three pairs of coordinates.

Overrides:
triangle in class processing.core.PGraphics
Parameters:
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.

beginShape

public void beginShape()
Starts a new shape of type POLYGON. This must be paired with a call to endShape() or one of its variants.

Overrides:
beginShape in class processing.core.PGraphics

beginShape

public void beginShape(int mode)
Starts a new shape of the type specified in the mode parameter. This must be paired with a call to endShape() or one of its variants.

Overrides:
beginShape in class processing.core.PGraphics2D
Parameters:
mode - either POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP

vertex

public void vertex(float x,
                   float y)
Overrides:
vertex in class processing.core.PGraphics

endShape

public void endShape()
Ends a shape definition. This should have been paired with a call to 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.

Overrides:
endShape in class processing.core.PGraphics

endShape

public void endShape(int mode)
Ends a shape definition. This should have been paired with a call to beginShape() or one of its variants. If the mode parameter is CLOSE the shape will be closed.

Overrides:
endShape in class processing.core.PGraphics2D


handy V.1.0, API documentation generated 30th January, 2012