public class HPGLGraphics extends PGraphics
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HPGL |
static java.lang.String |
VERSION |
A, AB, AG, ambientB, ambientColor, ambientG, ambientR, AR, B, backgroundColor, BEEN_LIT, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveDetail, curveTightness, DA, DB, DEFAULT_VERTICES, DG, DR, EB, edge, EDGE, EG, ellipseMode, emissiveB, emissiveColor, emissiveG, emissiveR, ER, fill, fillColor, G, HAS_NORMAL, image, imageMode, normalX, normalY, normalZ, NX, NY, NZ, pixelCount, R, rectMode, SA, SB, setAmbient, SG, shapeMode, SHINE, shininess, smooth, SPB, specularB, specularColor, specularG, specularR, SPG, sphereDetailU, sphereDetailV, SPR, SR, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, SW, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor, TX, TY, TZ, U, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ
ALPHA_MASK, BLUE_MASK, format, GREEN_MASK, height, loaded, parent, pixelDensity, pixelHeight, pixels, pixelWidth, RED_MASK, width
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
Constructor and Description |
---|
HPGLGraphics()
a Constructor, usually called in the setup() method in your sketch to
initialize and start the Library.
|
Modifier and Type | Method and Description |
---|---|
void |
arc(float x,
float y,
float w,
float h,
float start,
float stop) |
void |
arc(float x,
float y,
float w,
float h,
float start,
float stop,
int mode) |
void |
beginDraw() |
void |
beginShape()
begin a shape.
|
void |
beginShape(int kind)
begin a shape
|
void |
bezierVertex(float x2,
float y2,
float x3,
float y3,
float x4,
float y4) |
void |
blendMode(int mode) |
void |
curveVertex(float x,
float y) |
boolean |
displayable() |
void |
dispose() |
void |
ellipseImpl(float x,
float y,
float w,
float h)
This method implements the ellipse() method
|
void |
endDraw() |
void |
endRecord() |
void |
endRecord(java.lang.String filePath) |
void |
endShape() |
void |
endShape(int mode) |
boolean |
is2D() |
boolean |
is3D() |
void |
line(float x1,
float y1,
float x2,
float y2)
This method draws a line
|
void |
point(float x,
float y) |
void |
popMatrix() |
void |
println(java.lang.String what)
Write a line to the HPGL file.
|
void |
pushMatrix() |
void |
rectImpl(float x1,
float y1,
float x2,
float y2) |
void |
resetMatrix() |
void |
rotate(float angle) |
void |
scale(float s) |
void |
scale(float x,
float y) |
void |
selectPen(int pen)
This method selects plotter pen via the HPGL 'SP' instruction.
|
void |
setChordAngle(float ca)
This method sets the chord angle (in degrees) used for drawing arcs, circles and ellipses.
|
void |
setCurveDetail(int d)
This method sets the plotter output size.
|
void |
setPaperSize(java.lang.String size) |
void |
setPath(java.lang.String path)
This method sets the path and filename for the HPGL output.
|
void |
setSpeed(int speed)
This method sets speed for pen moves when down via the HPGL 'VS' instruction.
|
void |
text(java.lang.String s,
float x,
float y)
This method puts text in the HPGL output.
|
void |
textSize(float sizepx)
This method sets text size in the HPGL output.
|
void |
translate(float x,
float y) |
void |
vertex(float x,
float y)
This method converts vertices in Processing coordinates to
plotter coordinates.
|
void |
write(java.lang.String cmd,
float val)
Write a command on one line (as a String), then start a new line
and write out a formatted float.
|
alpha, ambient, ambient, ambient, ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, applyMatrix, applyMatrix, attrib, attrib, attrib, attribColor, attribNormal, attribPosition, background, background, background, background, background, background, background, beginCamera, beginContour, beginPGL, beginRaw, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, blue, box, box, brightness, camera, camera, clear, clip, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, createShape, createShape, createShape, createSurface, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, directionalLight, edge, ellipse, ellipseMode, emissive, emissive, emissive, endCamera, endContour, endPGL, endRaw, fill, fill, fill, fill, fill, fill, filter, flush, frustum, getCache, getMatrix, getMatrix, getMatrix, getRaw, getStyle, getStyle, green, haveRaw, hint, hue, image, image, image, imageMode, is2X, isGL, lerpColor, lerpColor, lightFalloff, lights, lightSpecular, line, loadShader, loadShader, loadShape, loadShape, modelX, modelY, modelZ, noClip, noFill, noLights, normal, noSmooth, noStroke, noTexture, noTint, ortho, ortho, ortho, perspective, perspective, point, pointLight, popStyle, printCamera, printMatrix, printProjection, pushStyle, quad, quadraticVertex, quadraticVertex, rect, rect, rect, rectMode, red, removeCache, resetShader, resetShader, rotate, rotateX, rotateY, rotateZ, saturation, save, scale, screenX, screenX, screenY, screenY, screenZ, setCache, setMatrix, setMatrix, setMatrix, setParent, setPrimary, setSize, shader, shader, shape, shape, shape, shapeMode, shearX, shearY, shininess, showDepthWarning, showDepthWarningXYZ, showException, showMethodWarning, showMissingWarning, showVariationWarning, showWarning, showWarning, smooth, smooth, specular, specular, specular, sphere, sphereDetail, sphereDetail, spotLight, stroke, stroke, stroke, stroke, stroke, stroke, strokeCap, strokeJoin, strokeWeight, style, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, texture, textureMode, textureWrap, textWidth, textWidth, textWidth, tint, tint, tint, tint, tint, tint, translate, triangle, vertex, vertex, vertex, vertex
blend, blend, blendColor, clone, copy, copy, copy, filter, filter, get, get, get, getImage, getModifiedX1, getModifiedX2, getModifiedY1, getModifiedY2, getNative, init, init, isLoaded, isModified, loadPixels, mask, mask, resize, set, set, setLoaded, setLoaded, setModified, setModified, updatePixels, updatePixels
public static final java.lang.String HPGL
public static final java.lang.String VERSION
public HPGLGraphics()
import hpglgraphics.*; void setup() { size(1104, 772); stroke(0); background(255); noFill(); // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("output.hpgl"); // (most) things between begin- and endRecord are written to the .hpgl file beginRecord(hpgl); rect(200, 200, 200, 200); ellipse(800, 300, 200, 200); pushMatrix(); translate(150, 100); int cellsize=64; rect(0, 0, cellsize, cellsize); for (int i=0; i
public void setCurveDetail(int d)
size
- String: "A3" or "A4", depending on the intended plot sizeimport hpglgraphics.*; void setup() { size(1104, 772); stroke(0); background(255); noFill(); // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("output.hpgl"); // (most) things between begin- and endRecord are written to the .hpgl file beginRecord(hpgl); rect(200, 200, 200, 200); ellipse(800, 300, 200, 200); pushMatrix(); translate(150, 100); int cellsize=64; rect(0, 0, cellsize, cellsize); for (int i=0; i
public void setPaperSize(java.lang.String size)
public void setPath(java.lang.String path)
setPath
in class PGraphics
path
- String: name of file to save toimport hpglgraphics.*; void setup() { size(1104, 772); stroke(0); background(255); noFill(); // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("output.hpgl"); // (most) things between begin- and endRecord are written to the .hpgl file beginRecord(hpgl); rect(200, 200, 200, 200); ellipse(800, 300, 200, 200); pushMatrix(); translate(150, 100); int cellsize=64; rect(0, 0, cellsize, cellsize); for (int i=0; i
public void selectPen(int pen)
pen
- : integer number of pen to select (depends on plotter)import hpglgraphics.*; void setup() { size(1104, 772); stroke(0); background(255); noFill(); // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("output.hpgl"); // (most) things between begin- and endRecord are written to the .hpgl file beginRecord(hpgl); rect(200, 200, 200, 200); ellipse(800, 300, 200, 200); pushMatrix(); translate(150, 100); int cellsize=64; rect(0, 0, cellsize, cellsize); for (int i=0; i
public void setSpeed(int speed)
speed
- : integer number for speed from 0 to 127import hpglgraphics.*; int lines = 30; void setup() { size(1104, 772); HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("output.hpgl"); background(255); stroke(0); fill(0); beginRecord(hpgl); // draw lines at incremental speed // Speed is set with the HPGL 'VS' instruction. This is a device-dependent velocity // in mm/sec. Some devices will cap this at the maximum possible (e.g. // Roland DXY-1350A will limit VS to 42mm/sec). Check that value you're setting here // is suitable for your plotter!! for(int i = 0; i < lines; i++) { hpgl.setSpeed(i); int y = height / lines * (i + 1); line(0, y, width, y); } endRecord(); } void draw() { }
public void endRecord()
public void endRecord(java.lang.String filePath)
public void beginShape()
beginShape
in class PGraphics
import hpglgraphics.*; PShape s; void setup() { size(1104, 772); // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A3"); hpgl.setPath("output.hpgl"); background(255); stroke(0); noFill(); beginRecord(hpgl); // a bounding box rect(0,0,width-1,height-1); // overlapping rects, one rotated pushMatrix(); translate(200,100); rect(0, 0, 180, 180); rotate(radians(45)); rect(-30, -30, 96, 96); popMatrix(); // selectPen(n): Select a pen. hp2xx can display pen colours via "-c" // -c 11111111 = all black pens // 0=off, 1=black, 2=red, 3=green, 4=blue, 5=cyan, // 6=magenta, 7=yellow. // Default pen is pen 1. // a diagonal line //hpgl.selectPen(2); line(50, 50, width-50, height-50); // Circle and radial line //hpgl.selectPen(3); pushMatrix(); translate(width/4, 3*height/4); rotate(radians(-45)); ellipse(0,0,260, 260); line(0,0,130,0); popMatrix(); // A PShape //hpgl.selectPen(6); pushMatrix(); translate(500, 675); PShape s; s = createShape(); s.beginShape(); s.vertex(0,0); s.vertex(-50,-100); s.vertex(150,-100); s.vertex(100,0); s.endShape(CLOSE); shape(s); translate(100, -220); rotate(radians(180)); //hpgl.selectPen(5); shape(s); popMatrix(); //hpgl.selectPen(1); pushMatrix(); translate(100, 100); // draw a triangle using CLOSE stroke(255,0,0); beginShape(); vertex(570, 125); vertex(880, 270); vertex(780, 70); endShape(CLOSE); stroke(0,0,255); beginShape(); vertex(360, -20); vertex(410, 75); vertex(480, 120); vertex(550, 20); vertex(680, 0); endShape(); popMatrix(); endRecord(); } void draw() { } void mouseReleased() { } import java.util.Calendar; // timestamp String timestamp() { Calendar now = Calendar.getInstance(); return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now); } void keyReleased() { if (key == 's' || key == 'S') { //saveFrame(timestamp()+"_####.png"); save(timestamp()+".png"); } }
public void beginShape(int kind)
beginShape
in class PGraphics
kind
- : type of shape (see Processing docs for beginShape())import hpglgraphics.*; PShape s; void setup() { size(1104, 772); // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A3"); hpgl.setPath("output.hpgl"); background(255); stroke(0); noFill(); beginRecord(hpgl); // a bounding box rect(0,0,width-1,height-1); // overlapping rects, one rotated pushMatrix(); translate(200,100); rect(0, 0, 180, 180); rotate(radians(45)); rect(-30, -30, 96, 96); popMatrix(); // selectPen(n): Select a pen. hp2xx can display pen colours via "-c" // -c 11111111 = all black pens // 0=off, 1=black, 2=red, 3=green, 4=blue, 5=cyan, // 6=magenta, 7=yellow. // Default pen is pen 1. // a diagonal line //hpgl.selectPen(2); line(50, 50, width-50, height-50); // Circle and radial line //hpgl.selectPen(3); pushMatrix(); translate(width/4, 3*height/4); rotate(radians(-45)); ellipse(0,0,260, 260); line(0,0,130,0); popMatrix(); // A PShape //hpgl.selectPen(6); pushMatrix(); translate(500, 675); PShape s; s = createShape(); s.beginShape(); s.vertex(0,0); s.vertex(-50,-100); s.vertex(150,-100); s.vertex(100,0); s.endShape(CLOSE); shape(s); translate(100, -220); rotate(radians(180)); //hpgl.selectPen(5); shape(s); popMatrix(); //hpgl.selectPen(1); pushMatrix(); translate(100, 100); // draw a triangle using CLOSE stroke(255,0,0); beginShape(); vertex(570, 125); vertex(880, 270); vertex(780, 70); endShape(CLOSE); stroke(0,0,255); beginShape(); vertex(360, -20); vertex(410, 75); vertex(480, 120); vertex(550, 20); vertex(680, 0); endShape(); popMatrix(); endRecord(); } void draw() { } void mouseReleased() { } import java.util.Calendar; // timestamp String timestamp() { Calendar now = Calendar.getInstance(); return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now); } void keyReleased() { if (key == 's' || key == 'S') { //saveFrame(timestamp()+"_####.png"); save(timestamp()+".png"); } }
public void vertex(float x, float y)
vertex
in class PGraphics
import hpglgraphics.*; PShape s; void setup() { size(1104, 772); // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A3"); hpgl.setPath("output.hpgl"); background(255); stroke(0); noFill(); beginRecord(hpgl); // a bounding box rect(0,0,width-1,height-1); // overlapping rects, one rotated pushMatrix(); translate(200,100); rect(0, 0, 180, 180); rotate(radians(45)); rect(-30, -30, 96, 96); popMatrix(); // selectPen(n): Select a pen. hp2xx can display pen colours via "-c" // -c 11111111 = all black pens // 0=off, 1=black, 2=red, 3=green, 4=blue, 5=cyan, // 6=magenta, 7=yellow. // Default pen is pen 1. // a diagonal line //hpgl.selectPen(2); line(50, 50, width-50, height-50); // Circle and radial line //hpgl.selectPen(3); pushMatrix(); translate(width/4, 3*height/4); rotate(radians(-45)); ellipse(0,0,260, 260); line(0,0,130,0); popMatrix(); // A PShape //hpgl.selectPen(6); pushMatrix(); translate(500, 675); PShape s; s = createShape(); s.beginShape(); s.vertex(0,0); s.vertex(-50,-100); s.vertex(150,-100); s.vertex(100,0); s.endShape(CLOSE); shape(s); translate(100, -220); rotate(radians(180)); //hpgl.selectPen(5); shape(s); popMatrix(); //hpgl.selectPen(1); pushMatrix(); translate(100, 100); // draw a triangle using CLOSE stroke(255,0,0); beginShape(); vertex(570, 125); vertex(880, 270); vertex(780, 70); endShape(CLOSE); stroke(0,0,255); beginShape(); vertex(360, -20); vertex(410, 75); vertex(480, 120); vertex(550, 20); vertex(680, 0); endShape(); popMatrix(); endRecord(); } void draw() { } void mouseReleased() { } import java.util.Calendar; // timestamp String timestamp() { Calendar now = Calendar.getInstance(); return String.format("%1$ty%1$tm%1$td_%1$tH%1$tM%1$tS", now); } void keyReleased() { if (key == 's' || key == 'S') { //saveFrame(timestamp()+"_####.png"); save(timestamp()+".png"); } }
public void curveVertex(float x, float y)
curveVertex
in class PGraphics
import hpglgraphics.*; void setup(){ size(1200, 900); background(255); stroke(0); noFill(); HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("curves.hpgl"); beginRecord(hpgl); strokeWeight(1); beginShape(); curveVertex(50, 50); curveVertex(50, 50); curveVertex(400, 200); curveVertex(500, 400); curveVertex(700, 700); endShape(); beginShape(); vertex( 50, 50); bezierVertex(200, 600, 400, 200, 500, 400); endShape(); //BEZIER VERTEX beginShape(); vertex(520, 400); bezierVertex(700, 348, 532, 459, 589, 92); endShape(); // CURVE VERTEX pushMatrix(); translate(300, 0); beginShape(); curveVertex(200, 800); curveVertex(390, 270); curveVertex(532, 376); curveVertex(750, 100); curveVertex(0,0); endShape(); popMatrix(); beginShape(); vertex(230, 220); bezierVertex(280, 200, 280, 275, 230, 275); bezierVertex(250, 280, 260, 225, 230, 220); endShape(); endRecord(); }
public void bezierVertex(float x2, float y2, float x3, float y3, float x4, float y4)
bezierVertex
in class PGraphics
import hpglgraphics.*; void setup(){ size(1200, 900); background(255); stroke(0); noFill(); HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("curves.hpgl"); beginRecord(hpgl); strokeWeight(1); beginShape(); curveVertex(50, 50); curveVertex(50, 50); curveVertex(400, 200); curveVertex(500, 400); curveVertex(700, 700); endShape(); beginShape(); vertex( 50, 50); bezierVertex(200, 600, 400, 200, 500, 400); endShape(); //BEZIER VERTEX beginShape(); vertex(520, 400); bezierVertex(700, 348, 532, 459, 589, 92); endShape(); // CURVE VERTEX pushMatrix(); translate(300, 0); beginShape(); curveVertex(200, 800); curveVertex(390, 270); curveVertex(532, 376); curveVertex(750, 100); curveVertex(0,0); endShape(); popMatrix(); beginShape(); vertex(230, 220); bezierVertex(280, 200, 280, 275, 230, 275); bezierVertex(250, 280, 260, 225, 230, 220); endShape(); endRecord(); }
public void setChordAngle(float ca)
ca:
- chord angle (degrees)import hpglgraphics.*; void setup() { // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) size(1104, 772); HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("arcs.hpgl"); background(255); stroke(0); noFill(); beginRecord(hpgl); rect(10,10,width-20,height-20); pushMatrix(); translate(200,200); point(0,0); arc(0, 0, 200, 200, radians(-90), radians(160), PIE); popMatrix(); pushMatrix(); translate(450, 200); arc(0, 0, 200, 200, radians(90), radians(160), PIE); popMatrix(); pushMatrix(); translate(700, 200); rotate(radians(90)); arc(0, 0, 200, 200, radians(80), radians(280)); popMatrix(); pushMatrix(); translate(950, 200); rotate(radians(45)); point(0,0); hpgl.setChordAngle(6); arc(0, 0, 200, 200, radians(-30), radians(90), CHORD); arc(0, 0, 200, 200, radians(150), radians(270), CHORD); ellipse(0, 0, 220, 220); popMatrix(); pushMatrix(); translate(200, 575); arc(0, 0, 320, 320, radians(45), radians(350), PIE); rotate(radians(90)); arc(0, 0, 240, 240, radians(35), radians(360), PIE); rotate(radians(90)); arc(0, 0, 160, 160, radians(25), radians(370), PIE); popMatrix(); pushMatrix(); translate(550, 575); arc(0, 0, 320, 320, radians(85), radians(350), CHORD); popMatrix(); pushMatrix(); translate(900, 575); arc(0, 0, 320, 320, radians(345), radians(360), PIE); popMatrix(); endRecord(); } void draw() { }
public void line(float x1, float y1, float x2, float y2)
line
in class PGraphics
x1,
- y1, x2, y2: start and end coordinates of lineimport hpglgraphics.*; void setup() { size(1104, 772); stroke(0); background(255); noFill(); // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("output.hpgl"); // (most) things between begin- and endRecord are written to the .hpgl file beginRecord(hpgl); rect(200, 200, 200, 200); ellipse(800, 300, 200, 200); pushMatrix(); translate(150, 100); int cellsize=64; rect(0, 0, cellsize, cellsize); for (int i=0; i
public void ellipseImpl(float x, float y, float w, float h)
ellipseImpl
in class PGraphics
x,
- y, w, h: center-coordinates, width and height of ellipse.import hpglgraphics.*; void setup() { // HPGL (Roland DXY-1350A) coordinate ranges: // A4 : 11040 x 7721 (297 x 210 mm) // A3 : 16158 x 11040 (420 x 297 mm) size(800, 800); HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("ellipse.hpgl"); background(255); stroke(0); noFill(); beginRecord(hpgl); rect(10,10,width-20,height-20); pushMatrix(); translate(width/2, height/2); for (int i=0; i<6; i++) { ellipse(0, -height/4, width/5, height/3); rotate(radians(60)); } popMatrix(); endRecord(); } void draw() { }
public void arc(float x, float y, float w, float h, float start, float stop)
public void arc(float x, float y, float w, float h, float start, float stop, int mode)
public void rectImpl(float x1, float y1, float x2, float y2)
public void text(java.lang.String s, float x, float y)
text
in class PGraphics
s
- String : text to writex
- float : x location (pixels)y
- float : y location (pixels)import hpglgraphics.*; void setup() { size(1104, 772); HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("output.hpgl"); background(255); stroke(0); fill(0); int off=200; String s1 = "First text"; String s2 = "Second text"; String s3 = "Third text"; beginRecord(hpgl); pushMatrix(); translate(100, height/2-off); textSize(16); text(s1, 0, height/4); translate(textWidth(s1)+100, 0); textSize(20); text(s2, 0, height/4); translate(textWidth(s2)+200, 0); textSize(24); text(s3, 0, height/4); popMatrix(); endRecord(); } void draw() { }
public void textSize(float sizepx)
textSize
in class PGraphics
sizepx
- float : size of the text in pixelsimport hpglgraphics.*; void setup() { size(1104, 772); HPGLGraphics hpgl = (HPGLGraphics) createGraphics(width, height, HPGLGraphics.HPGL); hpgl.setPaperSize("A4"); hpgl.setPath("output.hpgl"); background(255); stroke(0); fill(0); int off=200; String s1 = "First text"; String s2 = "Second text"; String s3 = "Third text"; beginRecord(hpgl); pushMatrix(); translate(100, height/2-off); textSize(16); text(s1, 0, height/4); translate(textWidth(s1)+100, 0); textSize(20); text(s2, 0, height/4); translate(textWidth(s2)+200, 0); textSize(24); text(s3, 0, height/4); popMatrix(); endRecord(); } void draw() { }
public void pushMatrix()
pushMatrix
in class PGraphics
public void write(java.lang.String cmd, float val)
cmd
- HPGL commandval
- HPGL parameterpublic void println(java.lang.String what)
what
- String to writepublic boolean displayable()
displayable
in class PGraphics
public void resetMatrix()
resetMatrix
in class PGraphics
Processing Library hpglgraphics by Ciaron Linstead. (c) 2017