本文整理了Java中java.awt.geom.AffineTransform.setToRotation()
方法的一些代码示例,展示了AffineTransform.setToRotation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AffineTransform.setToRotation()
方法的具体详情如下:
包路径:java.awt.geom.AffineTransform
类名称:AffineTransform
方法名:setToRotation
暂无
代码示例来源:origin: org.apache.poi/poi-ooxml
at.setToRotation(c);
path.append(at.createTransformedShape(arc), false);
代码示例来源:origin: geotools/geotools
/** Checks for {@linkplain #checkPermission permission} before setting this transform. */
@Override
public void setToRotation(double theta, double x, double y) {
checkPermission();
super.setToRotation(theta, x, y);
}
代码示例来源:origin: geotools/geotools
/** Checks for {@linkplain #checkPermission permission} before setting this transform. */
@Override
public void setToRotation(double theta) {
checkPermission();
super.setToRotation(theta);
}
代码示例来源:origin: de.sciss/scisslib
private void recalculateTransforms() {
trnsVertical.setToRotation(-Math.PI / 2, (double) recentHeight / 2,
(double) recentHeight / 2);
}
代码示例来源:origin: stackoverflow.com
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
AffineTransform tx = new AffineTransform();
tx.setToRotation(Math.toRadians(tank1.getAngle());
tx.translate(tank1.getCenter().getX(), tank1.getCenter().getY());
g2d.drawImage(tank1.getImage(), tx, this);
AffineTransform tx2 = new AffineTransform();
tx2.setToRotation(Math.toRadians(tank2.getAngle());
tx2.translate(tank2.getCenter().getX(), tank2.getCenter().getY());
g2d.drawImage(tank2.getImage(), tx2, this);
}
代码示例来源:origin: stackoverflow.com
private void drawName(Graphics g, String name, int x) {
Graphics2D g2d = (Graphics2D) g;
// clockwise 90 degrees
AffineTransform at = new AffineTransform();
// thanks to M.C. Henle for the bug fix!
at.setToRotation(Math.PI / 2.0, x + (barWidth / 4), bottom + 3);
AffineTransform prev = g2d.getTransform();
g2d.setTransform(at);
g2d.setColor(Color.BLACK);
g2d.drawString(name, (int) (x + (barWidth / 4)), (int) bottom + 3);
g2d.setTransform(prev);
}
代码示例来源:origin: org.apache.sis.core/sis-referencing
/**
* Checks for {@linkplain #checkPermission() permission} before setting this transform.
*/
@Override
public final void setToRotation(double theta, double anchorx, double anchory) {
checkPermission();
super.setToRotation(theta, anchorx, anchory);
}
代码示例来源:origin: org.apache.sis.core/sis-referencing
/**
* Checks for {@linkplain #checkPermission() permission} before setting this transform.
*/
@Override
public final void setToRotation(double theta) {
checkPermission();
super.setToRotation(theta);
}
代码示例来源:origin: org.apache.sis.core/sis-referencing
/**
* Checks for {@linkplain #checkPermission() permission} before setting this transform.
*/
@Override
public final void setToRotation(double vecx, double vecy) {
checkPermission();
super.setToRotation(vecx, vecy);
}
代码示例来源:origin: org.apache.sis.core/sis-referencing
/**
* Checks for {@linkplain #checkPermission() permission} before setting this transform.
*/
@Override
public final void setToRotation(double vecx, double vecy, double anchorx, double anchory) {
checkPermission();
super.setToRotation(vecx, vecy, anchorx, anchory);
}
代码示例来源:origin: apache/sis
/**
* Checks for {@linkplain #checkPermission() permission} before setting this transform.
*/
@Override
public final void setToRotation(double theta) {
checkPermission();
super.setToRotation(theta);
}
代码示例来源:origin: apache/sis
/**
* Checks for {@linkplain #checkPermission() permission} before setting this transform.
*/
@Override
public final void setToRotation(double theta, double anchorx, double anchory) {
checkPermission();
super.setToRotation(theta, anchorx, anchory);
}
代码示例来源:origin: apache/sis
/**
* Checks for {@linkplain #checkPermission() permission} before setting this transform.
*/
@Override
public final void setToRotation(double vecx, double vecy) {
checkPermission();
super.setToRotation(vecx, vecy);
}
代码示例来源:origin: apache/sis
/**
* Checks for {@linkplain #checkPermission() permission} before setting this transform.
*/
@Override
public final void setToRotation(double vecx, double vecy, double anchorx, double anchory) {
checkPermission();
super.setToRotation(vecx, vecy, anchorx, anchory);
}
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Draws the needle.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param rotate the rotation point.
* @param angle the angle.
*/
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea,
Point2D rotate, double angle) {
Line2D shape = new Line2D.Double();
double x = plotArea.getMinX() + (plotArea.getWidth() / 2);
shape.setLine(x, plotArea.getMinY(), x, plotArea.getMaxY());
Shape s = shape;
if ((rotate != null) && (angle != 0)) {
/// we have rotation
getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
s = getTransform().createTransformedShape(s);
}
defaultDisplay(g2, s);
}
代码示例来源:origin: jfree/jfreechart
/**
* Draws the needle.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param rotate the rotation point.
* @param angle the angle.
*/
@Override
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea,
Point2D rotate, double angle) {
Line2D shape = new Line2D.Double();
double x = plotArea.getMinX() + (plotArea.getWidth() / 2);
shape.setLine(x, plotArea.getMinY(), x, plotArea.getMaxY());
Shape s = shape;
if ((rotate != null) && (angle != 0)) {
/// we have rotation
getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
s = getTransform().createTransformedShape(s);
}
defaultDisplay(g2, s);
}
代码示例来源:origin: jfree/jfreechart
/**
* Draws the needle.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param rotate the rotation point.
* @param angle the angle.
*/
@Override
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea,
Point2D rotate, double angle) {
GeneralPath shape = new GeneralPath();
shape.append(new Arc2D.Double(-9.0, -7.0, 10, 14, 0.0, 25.5,
Arc2D.OPEN), true);
shape.append(new Arc2D.Double(0.0, -7.0, 10, 14, 154.5, 25.5,
Arc2D.OPEN), true);
shape.closePath();
getTransform().setToTranslation(plotArea.getMinX(), plotArea.getMaxY());
getTransform().scale(plotArea.getWidth(), plotArea.getHeight() / 3);
shape.transform(getTransform());
if ((rotate != null) && (angle != 0)) {
/// we have rotation
getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
shape.transform(getTransform());
}
defaultDisplay(g2, shape);
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Draws the needle.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
* @param rotate the rotation point.
* @param angle the angle.
*/
protected void drawNeedle(Graphics2D g2, Rectangle2D plotArea,
Point2D rotate, double angle) {
GeneralPath shape = new GeneralPath();
shape.append(new Arc2D.Double(-9.0, -7.0, 10, 14, 0.0, 25.5,
Arc2D.OPEN), true);
shape.append(new Arc2D.Double(0.0, -7.0, 10, 14, 154.5, 25.5,
Arc2D.OPEN), true);
shape.closePath();
getTransform().setToTranslation(plotArea.getMinX(), plotArea.getMaxY());
getTransform().scale(plotArea.getWidth(), plotArea.getHeight() / 3);
shape.transform(getTransform());
if ((rotate != null) && (angle != 0)) {
/// we have rotation
getTransform().setToRotation(angle, rotate.getX(), rotate.getY());
shape.transform(getTransform());
}
defaultDisplay(g2, shape);
}
代码示例来源:origin: apache/sis
/**
* Sets random values in the given affine transform and a copy of those values in the given matrix.
*/
private void setRandomValues(final AffineTransform at, final MatrixSIS matrix) {
at.setToRotation(random.nextDouble() * StrictMath.PI);
at.scale(nextNonZeroRandom(), nextNonZeroRandom());
at.translate(random.nextDouble() * 100 - 50,
random.nextDouble() * 100 - 50);
matrix.setElements(new double[] {
at.getScaleX(), at.getShearX(), at.getTranslateX(),
at.getShearY(), at.getScaleY(), at.getTranslateY(),
0, 0, 1
});
}
内容来源于网络,如有侵权,请联系作者删除!