Refine search
private void appendAndRotate(GeneralPath generalPath, Point2D.Double point, LineSegmentInt seg, final Shape shape) { final AffineTransform at = AffineTransform.getTranslateInstance(point.x, point.y); final double theta = seg.getAngle(); at.rotate(theta); final Shape r = at.createTransformedShape(shape); generalPath.append(r, false); }
private BufferedImage adjustImage(BufferedImage gray) throws IOException { AffineTransform at = new AffineTransform(xform); Matrix m = new Matrix(at); at.scale(1.0 / Math.abs(m.getScalingFactorX()), 1.0 / Math.abs(m.getScalingFactorY())); Rectangle originalBounds = new Rectangle(gray.getWidth(), gray.getHeight()); Rectangle2D transformedBounds = at.createTransformedShape(originalBounds).getBounds2D(); at.preConcatenate(AffineTransform.getTranslateInstance(-transformedBounds.getMinX(), -transformedBounds.getMinY())); int width = (int) Math.ceil(transformedBounds.getWidth()); int height = (int) Math.ceil(transformedBounds.getHeight()); BufferedImage transformedGray = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY); Graphics2D g2 = (Graphics2D) transformedGray.getGraphics(); g2.drawImage(gray, at, null); g2.dispose(); return transformedGray; }
Point2D p = gv.getGlyphPosition(i); double theta = (double) i / (double) (length - 1) * Math.PI / 4; AffineTransform at = AffineTransform.getTranslateInstance(p.getX(), p.getY()); at.rotate(theta); Shape glyph = gv.getGlyphOutline(i); Shape transformedGlyph = at.createTransformedShape(glyph); g2.fill(transformedGlyph);
transAT = AffineTransform.getTranslateInstance(-cropBox.getLowerLeftX(), cropBox.getLowerLeftY()); s = flipAT.createTransformedShape(s); s = rotateAT.createTransformedShape(s); g2d.setColor(Color.green); g2d.draw(s);
int spaceX = sz - r.width; int spaceY = sz - r.height; AffineTransform trans = AffineTransform.getTranslateInstance( -r.x + (spaceX / 2), -r.y + (spaceY / 2)); System.out.println("Box2D " + trans); Shape shapeCentered = trans.createTransformedShape(shape1);
Rectangle2D bounds = at.createTransformedShape(unitRect).getBounds2D(); BufferedImage renderedPaint = new BufferedImage((int) Math.ceil(bounds.getWidth()), AffineTransform.getTranslateInstance(bounds.getMinX(), bounds.getMinY()), null);
int spaceX = sz - r.width; int spaceY = sz - r.height; AffineTransform trans = AffineTransform.getTranslateInstance( -r.x + (spaceX / 2), -r.y + (spaceY / 2)); Shape shapeCentered = trans.createTransformedShape(shape1);
public static void drawEllipse( EllipseRotated_F64 ellipse , double scale , Graphics2D g2 ) { AffineTransform rotate = new AffineTransform(); rotate.rotate(ellipse.phi); double w = scale*ellipse.a*2; double h = scale*ellipse.b*2; Shape shape = rotate.createTransformedShape(new Ellipse2D.Double(-w/2,-h/2,w,h)); shape = AffineTransform.getTranslateInstance(scale*ellipse.center.x,scale*ellipse.center.y).createTransformedShape(shape); g2.draw(shape); }
public static void drawEllipse( EllipseRotated_F64 ellipse , double scale , Graphics2D g2 ) { AffineTransform rotate = new AffineTransform(); rotate.rotate(ellipse.phi); double w = scale*ellipse.a*2; double h = scale*ellipse.b*2; Shape shape = rotate.createTransformedShape(new Ellipse2D.Double(-w/2,-h/2,w,h)); shape = AffineTransform.getTranslateInstance(scale*ellipse.center.x,scale*ellipse.center.y).createTransformedShape(shape); g2.draw(shape); }
private void transformArrowShape(Point2D down, Point2D out) { float x1 = (float) down.getX(); float y1 = (float) down.getY(); float x2 = (float) out.getX(); float y2 = (float) out.getY(); AffineTransform xform = AffineTransform.getTranslateInstance(x2, y2); float dx = x2 - x1; float dy = y2 - y1; float thetaRadians = (float) Math.atan2(dy, dx); xform.rotate(thetaRadians); arrowShape = xform.createTransformedShape(rawArrowShape); }
private void transformArrowShape(Point2D down, Point2D out) { float x1 = (float) down.getX(); float y1 = (float) down.getY(); float x2 = (float) out.getX(); float y2 = (float) out.getY(); AffineTransform xform = AffineTransform.getTranslateInstance(x2, y2); float dx = x2 - x1; float dy = y2 - y1; float thetaRadians = (float) Math.atan2(dy, dx); xform.rotate(thetaRadians); arrowShape = xform.createTransformedShape(rawArrowShape); } /** Used for the edge creation visual effect during mouse drag */
private void transformArrowShape(final Point2D down, final Point2D out) { final float x1 = (float) down.getX(); final float y1 = (float) down.getY(); final float x2 = (float) out.getX(); final float y2 = (float) out.getY(); final AffineTransform xform = AffineTransform.getTranslateInstance(x2, y2); final float dx = x2 - x1; final float dy = y2 - y1; final float thetaRadians = (float) Math.atan2(dy, dx); xform.rotate(thetaRadians); _arrowShape = xform.createTransformedShape(GraphUtils.ARROW_SHAPE); } }
private void transformArrowShape(Point2D down, Point2D out) { float x1 = (float) down.getX(); float y1 = (float) down.getY(); float x2 = (float) out.getX(); float y2 = (float) out.getY(); AffineTransform xform = AffineTransform.getTranslateInstance(x2, y2); float dx = x2-x1; float dy = y2-y1; float thetaRadians = (float) Math.atan2(dy, dx); xform.rotate(thetaRadians); arrowShape = xform.createTransformedShape(rawArrowShape); } /**
/** * Returns a Shape whose interior corresponds to the visual representation * of this GlyphVector, offset to x, y. */ public Shape getOutline(float x, float y) { Shape outline = getOutline(); AffineTransform tr = AffineTransform.getTranslateInstance(x,y); Shape translatedOutline = tr.createTransformedShape(outline); return translatedOutline; }
/** * Returns a Shape whose interior corresponds to the visual representation * of this GlyphVector, offset to x, y. */ public Shape getOutline(float x, float y) { Shape outline = getOutline(); AffineTransform tr = AffineTransform.getTranslateInstance(x,y); outline = tr.createTransformedShape(outline); return outline; }
/** * Returns a Shape whose interior corresponds to the visual representation * of this GlyphVector, offset to x, y. */ public Shape getOutline(float x, float y) { Shape outline = getOutline(); AffineTransform tr = AffineTransform.getTranslateInstance(x,y); outline = tr.createTransformedShape(outline); return outline; }
public Rectangle2D getForElement(N node, Point p) { Shape shape = (Shape) rc.getNodeShapeFunction().apply(node); // Point2D p = (Point2D) layoutModel.apply(node); log.trace("node is at {}", p); float x = (float) p.x; float y = (float) p.y; AffineTransform xform = AffineTransform.getTranslateInstance(x, y); return xform.createTransformedShape(shape).getBounds2D(); }
public Rectangle2D getForElement(N node, Point p) { Shape shape = (Shape) rc.getNodeShapeFunction().apply(node); // Point2D p = (Point2D) layoutModel.apply(node); log.trace("node is at {}", p); float x = (float) p.x; float y = (float) p.y; AffineTransform xform = AffineTransform.getTranslateInstance(x, y); return xform.createTransformedShape(shape).getBounds2D(); }
/** * Returns a Shape whose interior corresponds to the visual representation * of this GlyphVector, offset to x, y. */ public Shape getOutline(float x, float y) { Shape outline = getOutline(); AffineTransform tr = AffineTransform.getTranslateInstance(x,y); outline = tr.createTransformedShape(outline); return outline; }
/** * Returns a Shape whose interior corresponds to the visual representation * of this GlyphVector, offset to x, y. */ public Shape getOutline(float x, float y) { Shape outline = getOutline(); AffineTransform tr = AffineTransform.getTranslateInstance(x,y); Shape translatedOutline = tr.createTransformedShape(outline); return translatedOutline; }