AffineTransform translate = new AffineTransform(); translate.setToTranslation(offset, offset); shadow.transform(translate); g2.setColor(new Color(150,150,150)); g2.fill(shadow);
public void rotate(double radius) { init(); AffineTransform rat = new AffineTransform(); rat.rotate(radius, TRIANGLE_SIZE / 2, TRIANGLE_SIZE / 2); gp.transform(rat); }
private static Shape triangle() { GeneralPath trianglePath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); trianglePath.moveTo(0f, 1f); trianglePath.lineTo(0.866f, -.8f); trianglePath.lineTo(-0.866f, -.8f); trianglePath.lineTo(0f, 1f); AffineTransform at = new AffineTransform(); at.translate(0, -.10); at.scale(.5, .5); trianglePath.transform(at); ExplicitBoundsShape shape = new ExplicitBoundsShape(trianglePath); shape.setBounds(new Rectangle2D.Double(-.5, .5, 1., 1.)); return shape; }
private static Shape arrow() { GeneralPath arrowPath = new GeneralPath(GeneralPath.WIND_EVEN_ODD); arrowPath.moveTo(.3f, -.3f); arrowPath.lineTo(.5f, .0f); arrowPath.lineTo(.3f, .3f); arrowPath.lineTo(.3f, .1f); arrowPath.lineTo(-.5f, .1f); arrowPath.lineTo(-.5f, -.1f); arrowPath.lineTo(.3f, -.1f); arrowPath.lineTo(.3f, -.3f); AffineTransform at = new AffineTransform(); at.rotate(Math.PI / 2.0); arrowPath.transform(at); ExplicitBoundsShape shape = new ExplicitBoundsShape(arrowPath); shape.setBounds(new Rectangle2D.Double(-.5, .5, 1., 1.)); return shape; }
rat.setToTranslation(textBox.width + triangle.width, textBox.height); rat.rotate(Math.PI); flagShape.transform(rat); }else if (direction == DIRECTION_NORTH){ AffineTransform rat = new AffineTransform(); rat.setToTranslation(textBox.width, textBox.height+triangle.height); rat.rotate(Math.PI); flagShape.transform(rat);
@Override public GeneralPath getNormalizedPath(int code) throws IOException { boolean hasScaling = ttf.getUnitsPerEm() != 1000; float scale = 1000f / ttf.getUnitsPerEm(); int gid = codeToGID(code); GeneralPath path = getPath(code); // Acrobat only draws GID 0 for embedded CIDFonts, see PDFBOX-2372 if (gid == 0 && !isEmbedded()) { path = null; } if (path == null) { // empty glyph (e.g. space, newline) return new GeneralPath(); } else { if (hasScaling) { path.transform(AffineTransform.getScaleInstance(scale, scale)); } return path; } }
@Override public GeneralPath getNormalizedPath(int code) throws IOException { boolean hasScaling = ttf.getUnitsPerEm() != 1000; float scale = 1000f / ttf.getUnitsPerEm(); int gid = codeToGID(code); GeneralPath path = getPath(code); // Acrobat only draws GID 0 for embedded or "Standard 14" fonts, see PDFBOX-2372 if (gid == 0 && !isEmbedded() && !isStandard14()) { path = null; } if (path == null) { // empty glyph (e.g. space, newline) return new GeneralPath(); } else { if (hasScaling) { path.transform(AffineTransform.getScaleInstance(scale, scale)); } return path; } }
path.transform(postTransform);
/** * Delegates to the enclosed <code>GeneralPath</code>. */ public void transform(AffineTransform at) { path.transform(at); }
@Override public void move( final double displacement, final int d ) { if ( d != 0 && d != 1 ) throw new IllegalArgumentException( "Cannot move 2D ROI in dimension " + d ); final AffineTransform transform = AffineTransform.getTranslateInstance( d == 0 ? displacement : 0, d == 1 ? displacement : 0 ); path.transform( transform ); }
@Override protected void orientHex(GeneralPath hex) { // flip the half-hex over y = x AffineTransform at = new AffineTransform(); at.rotate(Math.toRadians(90.0)); at.scale(1, -1); hex.transform(at); }
private GeneralPath getPathD() { GeneralPath path = new GeneralPath(I_SHAPE); path.transform(AffineTransform.getTranslateInstance(27, 0)); GeneralPath bow = getPathPBow(); bow.transform(AffineTransform.getScaleInstance(-1, 1)); bow.transform(AffineTransform.getTranslateInstance(25, 20)); path.append(bow, false); return path; }
public Wedge(int width) { triangle = ArrowFactory.getWedgeArrow(width, 1); triangle.transform(AffineTransform.getTranslateInstance(1, 0)); BOW_TIE.moveTo(0, width / 2); BOW_TIE.lineTo(1, -width / 2); BOW_TIE.lineTo(1, width / 2); BOW_TIE.lineTo(0, -width / 2); BOW_TIE.closePath(); }
private GeneralPath getPathO() { GeneralPath path = getPathOBow(); path.transform(AffineTransform.getTranslateInstance(20, 0)); GeneralPath bow2 = getPathOBow(); bow2.transform(AffineTransform.getScaleInstance(-1, 1)); bow2.transform(AffineTransform.getTranslateInstance(18, 0)); path.append(bow2, false); return path; }
private GeneralPath getPathB() { GeneralPath path = new GeneralPath(I_SHAPE); GeneralPath bow = getPathPBow(); bow.transform(AffineTransform.getTranslateInstance(15, 20)); path.append(bow, false); return path; }
/** * Decrypt a glyph stored in byte form */ private synchronized GeneralPath parseGlyph(byte[] cs, FlPoint advance, AffineTransform at) { GeneralPath gp = new GeneralPath(); FlPoint curpoint = new FlPoint(); sloc = 0; parse(cs, gp, curpoint, advance); gp.transform(at); return gp; }
/** * Decrypt a glyph stored in byte form */ private synchronized GeneralPath parseGlyph(byte[] cs, FlPoint advance, AffineTransform at) { GeneralPath gp = new GeneralPath(); FlPoint curpoint = new FlPoint(); sloc = 0; parse(cs, gp, curpoint, advance); gp.transform(at); return gp; }