float x = lastX + next * dx * r; float y = lastY + next * dy * r; t.setToTranslation(x, y); t.rotate(angle); result.append(t.createTransformedShape(theShape), false);
GeneralPath shadow = new GeneralPath(path); AffineTransform translate = new AffineTransform(); translate.setToTranslation(offset, offset); shadow.transform(translate); g2.setColor(new Color(150,150,150));
nextAdvance = currentChar < length - 1 ? glyphVector.getGlyphMetrics( currentChar + 1).getAdvance() * 0.5f : 0; t.setToTranslation(x, y); t.rotate(angle); t.translate(-px - advance, -py + height * factor / 2.0f);
/** Checks for {@linkplain #checkPermission permission} before setting this transform. */ @Override public void setToTranslation(double tx, double ty) { checkPermission(); super.setToTranslation(tx, ty); }
RectangleStroke(Shape pShapes[]) { mShapes = new Shape[pShapes.length]; for (int i = 0; i < mShapes.length; i++) { Rectangle2D bounds = pShapes[i].getBounds2D(); mTransform.setToTranslation(-bounds.getCenterX(), -bounds.getCenterY()); mShapes[i] = mTransform.createTransformedShape(pShapes[i]); } }
float x = lastX + next * dx * r; float y = lastY + next * dy * r; mTransform.setToTranslation(x, y);
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);
Position p; while ((p = ps.getNextPosition()) != null) { at.setToTranslation(p.x, p.y); at.rotate(Math.toRadians(p.rotation)); List<AffineTransform2D> transforms = new ArrayList<AffineTransform2D>(); at.setToTranslation(mx, my); at.rotate(Math.toRadians(p.rotation)); AffineTransform2D tx2d = new AffineTransform2D(at);
c = cursor.getCurrentPosition(c); AffineTransform t = new AffineTransform(); t.setToTranslation(c.x, c.y); t.rotate(cursor.getCurrentAngle()); t.translate(-p.getX() - advance, -p.getY() + lineHeight * anchorY);
private Graphics2D prepareGraphics2D(final float offsetX, Graphics2D g2d) { if (offsetX != 0.0f) { g2d = (Graphics2D) g2d.create(); final AffineTransform transform = g2d.getTransform(); final AffineTransform offsetTrans = new AffineTransform(); offsetTrans.setToTranslation(+offsetX, 0); transform.concatenate(offsetTrans); g2d.setTransform(transform); } return g2d; }
private Graphics2D prepareGraphics2D(final float offsetX, Graphics2D g2d) { if (offsetX != 0.0f) { g2d = (Graphics2D) g2d.create(); final AffineTransform transform = g2d.getTransform(); final AffineTransform offsetTrans = new AffineTransform(); offsetTrans.setToTranslation(+offsetX, 0); transform.concatenate(offsetTrans); g2d.setTransform(transform); } return g2d; }
/** * Checks for {@linkplain #checkPermission() permission} before setting this transform. */ @Override public final void setToTranslation(double tx, double ty) { checkPermission(); super.setToTranslation(tx, ty); }
/** * Checks for {@linkplain #checkPermission() permission} before setting this transform. */ @Override public final void setToTranslation(double tx, double ty) { checkPermission(); super.setToTranslation(tx, ty); }
private Graphics2D prepareGraphics2D(final float offsetX, Graphics2D g2d) { if (offsetX != 0.0f) { g2d = (Graphics2D) g2d.create(); final AffineTransform transform = g2d.getTransform(); final AffineTransform offsetTrans = new AffineTransform(); offsetTrans.setToTranslation(+offsetX, 0); transform.concatenate(offsetTrans); g2d.setTransform(transform); } return g2d; }
AffineTransform at, toConcatenate; Graphics2D g2 = (Graphics2D)g; g2.setColor(Color.black); at = new AffineTransform(); toConcatenate = new AffineTransform(); at.setToTranslation(x,y); toConcatenate.setToRotation(theta); at.concatenate(toConcatenate); g2.setTransform(at) g2.drawPolygon(points);
RectangleStroke(Shape pShapes[]) { mShapes = new Shape[pShapes.length]; for (int i = 0; i < mShapes.length; i++) { Rectangle2D bounds = pShapes[i].getBounds2D(); mTransform.setToTranslation(-bounds.getCenterX(), -bounds.getCenterY()); mShapes[i] = mTransform.createTransformedShape(pShapes[i]); } }
RectangleStroke(Shape pShapes[]) { mShapes = new Shape[pShapes.length]; for (int i = 0; i < mShapes.length; i++) { Rectangle2D bounds = pShapes[i].getBounds2D(); mTransform.setToTranslation(-bounds.getCenterX(), -bounds.getCenterY()); mShapes[i] = mTransform.createTransformedShape(pShapes[i]); } }
public ShapeStroke( Shape shapes[], float advance, LineStyle lineStyle, float width ) { this.advance = advance; this.shapes = new Shape[shapes.length]; this.lineStyle = lineStyle; this.width = width; for ( int i = 0; i < this.shapes.length; i++ ) { Rectangle2D bounds = shapes[i].getBounds2D(); transform.setToTranslation( -bounds.getCenterX(), -bounds.getCenterY() ); this.shapes[i] = transform.createTransformedShape( shapes[i] ); } }
public ShapeStroke( Shape shapes[], float advance ) { this.advance = advance; this.shapes = new Shape[shapes.length]; for ( int i = 0; i < this.shapes.length; i++ ) { Rectangle2D bounds = shapes[i].getBounds2D(); t.setToTranslation( -bounds.getCenterX(), -bounds.getCenterY() ); this.shapes[i] = t.createTransformedShape( shapes[i] ); } }
/** * Formats a transformation matrix in millipoints with values as points. * @param transform the transformation matrix in millipoints * @return the formatted matrix in points */ public static String formatAffineTransformMptToPt(AffineTransform transform) { AffineTransform scaled = new AffineTransform(transform); scaled.setToTranslation( transform.getTranslateX() / 1000, transform.getTranslateY() / 1000); return IFUtil.toString(scaled); }