本文整理了Java中java.awt.geom.AffineTransform.getTranslateInstance()
方法的一些代码示例,展示了AffineTransform.getTranslateInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AffineTransform.getTranslateInstance()
方法的具体详情如下:
包路径:java.awt.geom.AffineTransform
类名称:AffineTransform
方法名:getTranslateInstance
暂无
代码示例来源:origin: plantuml/plantuml
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);
}
代码示例来源:origin: apache/pdfbox
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;
}
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: apache/pdfbox
transAT = AffineTransform.getTranslateInstance(-cropBox.getLowerLeftX(), cropBox.getLowerLeftY());
s = flipAT.createTransformedShape(s);
s = rotateAT.createTransformedShape(s);
g2d.setColor(Color.green);
g2d.draw(s);
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: apache/pdfbox
Rectangle2D bounds = at.createTransformedShape(unitRect).getBounds2D();
BufferedImage renderedPaint =
new BufferedImage((int) Math.ceil(bounds.getWidth()),
AffineTransform.getTranslateInstance(bounds.getMinX(), bounds.getMinY()),
null);
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: org.boofcv/visualize
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);
}
代码示例来源:origin: org.boofcv/boofcv-swing
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);
}
代码示例来源:origin: girtel/Net2Plan
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);
}
代码示例来源:origin: jrtom/jung
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 */
代码示例来源:origin: datacleaner/DataCleaner
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);
}
}
代码示例来源:origin: net.sf.jung/jung-visualization
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);
}
/**
代码示例来源:origin: org.apache.xmlgraphics/batik-gvt
/**
* 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;
}
代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik
/**
* 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;
}
代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik
/**
* 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;
}
代码示例来源:origin: jrtom/jung
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();
}
代码示例来源:origin: jrtom/jung
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();
}
代码示例来源:origin: org.apache.xmlgraphics/batik-gvt
/**
* 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;
}
代码示例来源:origin: apache/batik
/**
* 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;
}
内容来源于网络,如有侵权,请联系作者删除!