本文整理汇总了Java中java.awt.geom.AffineTransform.setToRotation方法的典型用法代码示例。如果您正苦于以下问题:Java AffineTransform.setToRotation方法的具体用法?Java AffineTransform.setToRotation怎么用?Java AffineTransform.setToRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.AffineTransform
的用法示例。
在下文中一共展示了AffineTransform.setToRotation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static void main(String[] args) {
Object aahints[] = {RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB,
RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB};
int i, j, k;
AffineTransform a = new AffineTransform();
for (i=0; i<aahints.length; i++) {
for(j=0; j<8; j++) {
System.out.println("Testing hint "+i+" angle="+j);
a.setToRotation(j*Math.PI/4);
testTransformedFont(a, aahints[i]);
}
testFontOfSize(0.0f, aahints[i]);
testFontOfSize(-10.0f, aahints[i]);
}
}
示例2: getAffineTransform
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private AffineTransform getAffineTransform( int transform ) {
/// ABP
AffineTransform at = new AffineTransform();
switch ( transform )
{
case SCALE:
at.setToScale( 1.5f, 1.5f ); break;
case ROTATE:
at.setToRotation( Math.PI / 6 ); break;
case SHEAR:
at.setToShear( 0.4f, 0 ); break;
case NONE:
break;
default:
//System.err.println( "Illegal G2 Transform Arg: " + transform);
break;
}
return at;
}
示例3: getArrowImage
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
protected Image getArrowImage() {
if (arrowImage == null) {
arrowImage = Guitilities.createTranslucentImage(size, size);
AffineTransform atx = direction != SOUTH ? new AffineTransform() : null;
switch (direction) {
case NORTH:
atx.setToRotation(Math.PI, size / 2, size / 2);
break;
case EAST:
atx.setToRotation(-(Math.PI / 2), size / 2, size / 2);
break;
case WEST:
atx.setToRotation(Math.PI / 2, size / 2, size / 2);
case SOUTH:
default: { /* no xform */}
}
Graphics2D ig = (Graphics2D) arrowImage.getGraphics();
if (atx != null) {
ig.setTransform(atx);
}
int width = size;
int height = size / 2 + 1;
int xx = (size - width) / 2;
int yy = (size - height + 1) / 2;
Color base = color != null ? color : UIManager.getColor("controlDkShadow").darker();
paintArrow(ig, base, xx, yy);
paintArrowBevel(ig, base, xx, yy);
paintArrowBevel(ig, Guitilities.deriveColorHSB(base, 0f, 0f, .20f), xx, yy + 1);
}
return arrowImage;
}
示例4: makeAT
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static AffineTransform makeAT(Mode mode, Point2D txpt,
double radians)
{
AffineTransform at;
double tx = (txpt == null) ? 0.0 : txpt.getX();
double ty = (txpt == null) ? 0.0 : txpt.getY();
switch (mode) {
case GET:
if (txpt != null) {
at = AffineTransform.getRotateInstance(radians, tx, ty);
} else {
at = AffineTransform.getRotateInstance(radians);
}
break;
case SET:
at = makeRandomAT();
if (txpt != null) {
at.setToRotation(radians, tx, ty);
} else {
at.setToRotation(radians);
}
break;
case MOD:
at = makeRandomAT();
at.setToIdentity();
if (txpt != null) {
at.rotate(radians, tx, ty);
} else {
at.rotate(radians);
}
break;
default:
throw new InternalError("unrecognized mode: "+mode);
}
return at;
}