/** * Scale in X, Y, and Z. */ public void scale(float x, float y, float z) { g.scale(x, y, z); }
/** * Scale in all dimensions. */ public void scale(float s) { g.scale(s); }
/** * Scale in X and Y. Equivalent to scale(sx, sy, 1). * <p/> * Not recommended for use in 3D, because the z-dimension is just * scaled by 1, since there's no way to know what else to scale it by. */ public void scale(float sx, float sy) { g.scale(sx, sy); }
/** * <h3>Advanced</h3> * Scale in X and Y. Equivalent to scale(sx, sy, 1). * * Not recommended for use in 3D, because the z-dimension is just * scaled by 1, since there's no way to know what else to scale it by. * * @param x percentage to scale the object in the x-axis * @param y percentage to scale the object in the y-axis */ public void scale(float x, float y) { if (recorder != null) recorder.scale(x, y); g.scale(x, y); }
public void drawChar(PGraphics g, char c, float x, float y, float size) { g.pushMatrix(); float s = size / face.unitsPerEm; g.translate(x, y); g.scale(s, -s); FontGlyph fg = unicodeGlyphs.get(Character.valueOf(c)); if (fg != null) g.shape(fg); g.popMatrix(); }
public void drawChar(PGraphics g, char c, float x, float y, float size) { g.pushMatrix(); float s = size / (float) face.unitsPerEm; g.translate(x, y); g.scale(s, -s); FontGlyph fg = (FontGlyph) unicodeGlyphs.get(new Character(c)); if (fg != null) g.shape(fg); g.popMatrix(); }
public void drawString(PGraphics g, String str, float x, float y, float size) { // 1) scale by the 1.0/unitsPerEm // 2) scale up by a font size g.pushMatrix(); float s = size / (float) face.unitsPerEm; //System.out.println("scale is " + s); // swap y coord at the same time, since fonts have y=0 at baseline g.translate(x, y); g.scale(s, -s); char[] c = str.toCharArray(); for (int i = 0; i < c.length; i++) { // call draw on each char (pulling it w/ the unicode table) FontGlyph fg = (FontGlyph) unicodeGlyphs.get(new Character(c[i])); if (fg != null) { fg.draw(g); // add horizAdvX/unitsPerEm to the x coordinate along the way g.translate(fg.horizAdvX, 0); } else { System.err.println("'" + c[i] + "' not available."); } } g.popMatrix(); }
public void drawString(PGraphics g, String str, float x, float y, float size) { // 1) scale by the 1.0/unitsPerEm // 2) scale up by a font size g.pushMatrix(); float s = size / face.unitsPerEm; //System.out.println("scale is " + s); // swap y coord at the same time, since fonts have y=0 at baseline g.translate(x, y); g.scale(s, -s); char[] c = str.toCharArray(); for (int i = 0; i < c.length; i++) { // call draw on each char (pulling it w/ the unicode table) FontGlyph fg = unicodeGlyphs.get(Character.valueOf(c[i])); if (fg != null) { fg.draw(g); // add horizAdvX/unitsPerEm to the x coordinate along the way g.translate(fg.horizAdvX, 0); } else { System.err.println("'" + c[i] + "' not available."); } } g.popMatrix(); }
public void shape(PShape shape, float x, float y, float c, float d) { if (shape.isVisible()) { // don't do expensive matrix ops if invisible pushMatrix(); if (shapeMode == CENTER) { // x and y are center, c and d refer to a diameter translate(x - c/2f, y - d/2f); scale(c / shape.getWidth(), d / shape.getHeight()); } else if (shapeMode == CORNER) { translate(x, y); scale(c / shape.getWidth(), d / shape.getHeight()); } else if (shapeMode == CORNERS) { // c and d are x2/y2, make them into width/height c -= x; d -= y; // then same as above translate(x, y); scale(c / shape.getWidth(), d / shape.getHeight()); } shape.draw(this); popMatrix(); } }
/** * @param a x-coordinate of the shape * @param b y-coordinate of the shape * @param c width to display the shape * @param d height to display the shape */ public void shape(PShape shape, float a, float b, float c, float d) { if (shape.isVisible()) { // don't do expensive matrix ops if invisible flush(); pushMatrix(); if (shapeMode == CENTER) { // x and y are center, c and d refer to a diameter translate(a - c/2f, b - d/2f); scale(c / shape.getWidth(), d / shape.getHeight()); } else if (shapeMode == CORNER) { translate(a, b); scale(c / shape.getWidth(), d / shape.getHeight()); } else if (shapeMode == CORNERS) { // c and d are x2/y2, make them into width/height c -= a; d -= b; // then same as above translate(a, b); scale(c / shape.getWidth(), d / shape.getHeight()); } shape.draw(this); popMatrix(); } }