本文整理匯總了Java中java.awt.geom.AffineTransform.TYPE_UNIFORM_SCALE屬性的典型用法代碼示例。如果您正苦於以下問題:Java AffineTransform.TYPE_UNIFORM_SCALE屬性的具體用法?Java AffineTransform.TYPE_UNIFORM_SCALE怎麽用?Java AffineTransform.TYPE_UNIFORM_SCALE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.geom.AffineTransform
的用法示例。
在下文中一共展示了AffineTransform.TYPE_UNIFORM_SCALE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getNativePointSize
private int getNativePointSize() {
/* Make a copy of the glyphTX in which we will store the
* font transform, inverting the devTx if necessary
*/
double[] mat = new double[4];
desc.glyphTx.getMatrix(mat);
fontTx = new AffineTransform(mat);
/* Now work backwards to get the font transform */
if (!desc.devTx.isIdentity() &&
desc.devTx.getType() != AffineTransform.TYPE_TRANSLATION) {
try {
invertDevTx = desc.devTx.createInverse();
fontTx.concatenate(invertDevTx);
} catch (NoninvertibleTransformException e) {
e.printStackTrace();
}
}
/* At this point the fontTx may be a simple +ve scale, or it
* may be something more complex.
*/
Point2D.Float pt = new Point2D.Float(1f,1f);
fontTx.deltaTransform(pt, pt);
double ptSize = Math.abs(pt.y);
int ttype = fontTx.getType();
if ((ttype & ~AffineTransform.TYPE_UNIFORM_SCALE) != 0 ||
fontTx.getScaleY() <= 0) {
/* We need to create an inverse transform that doesn't
* include the point size (strictly the uniform scale)
*/
fontTx.scale(1/ptSize, 1/ptSize);
} else {
fontTx = null; // no need
}
return (int)ptSize;
}
示例2: NativeStrike
NativeStrike(NativeFont nativeFont, FontStrikeDesc desc) {
super(nativeFont, desc);
this.nativeFont = nativeFont;
/* If this is a delegate for bitmaps, we expect to have
* been invoked only for a simple scale. If that's not
* true, just bail
*/
if (nativeFont.isBitmapDelegate) {
int ttype = desc.glyphTx.getType();
if ((ttype & ~AffineTransform.TYPE_UNIFORM_SCALE) != 0 ||
desc.glyphTx.getScaleX() <= 0) {
numGlyphs = 0;
return;
}
}
int ptSize = getNativePointSize();
byte [] nameBytes = nativeFont.getPlatformNameBytes(ptSize);
double scale = Math.abs(desc.devTx.getScaleX());
pScalerContext = createScalerContext(nameBytes, ptSize, scale);
if (pScalerContext == 0L) {
SunFontManager.getInstance().deRegisterBadFont(nativeFont);
pScalerContext = createNullScalerContext();
numGlyphs = 0;
if (FontUtilities.isLogging()) {
FontUtilities.getLogger()
.severe("Could not create native strike " +
new String(nameBytes));
}
return;
}
numGlyphs = nativeFont.getMapper().getNumGlyphs();
this.disposer = new NativeStrikeDisposer(nativeFont, desc,
pScalerContext);
}
示例3: getModifiedType
public static int getModifiedType(AffineTransform at) {
int type = at.getType();
// Some of the vector methods can introduce a tiny uniform scale
// at some angles...
if ((type & AffineTransform.TYPE_UNIFORM_SCALE) != 0) {
maxulps = Math.max(maxulps, ulps(at.getDeterminant(), 1.0));
if (ulps(at.getDeterminant(), 1.0) <= MAX_ULPS) {
// Really tiny - we will ignore it
type &= (~AffineTransform.TYPE_UNIFORM_SCALE);
}
}
return type;
}