当前位置: 首页>>代码示例>>Java>>正文


Java AffineTransform.setToRotation方法代码示例

本文整理汇总了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]);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:TestTransform.java

示例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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:FontPanel.java

示例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;
}
 
开发者ID:kristian,项目名称:JDigitalSimulator,代码行数:34,代码来源:ArrowIcon.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:TestRotateMethods.java


注:本文中的java.awt.geom.AffineTransform.setToRotation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。