本文整理汇总了Java中java.awt.geom.AffineTransform.deltaTransform方法的典型用法代码示例。如果您正苦于以下问题:Java AffineTransform.deltaTransform方法的具体用法?Java AffineTransform.deltaTransform怎么用?Java AffineTransform.deltaTransform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.AffineTransform
的用法示例。
在下文中一共展示了AffineTransform.deltaTransform方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertToUserSpace
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
void convertToUserSpace(AffineTransform invTx) {
Point2D.Float pt2D = new Point2D.Float();
pt2D.x = ascentX; pt2D.y = ascentY;
invTx.deltaTransform(pt2D, pt2D);
ascentX = pt2D.x; ascentY = pt2D.y;
pt2D.x = descentX; pt2D.y = descentY;
invTx.deltaTransform(pt2D, pt2D);
descentX = pt2D.x; descentY = pt2D.y;
pt2D.x = baselineX; pt2D.y = baselineY;
invTx.deltaTransform(pt2D, pt2D);
baselineX = pt2D.x; baselineY = pt2D.y;
pt2D.x = leadingX; pt2D.y = leadingY;
invTx.deltaTransform(pt2D, pt2D);
leadingX = pt2D.x; leadingY = pt2D.y;
pt2D.x = maxAdvanceX; pt2D.y = maxAdvanceY;
invTx.deltaTransform(pt2D, pt2D);
maxAdvanceX = pt2D.x; maxAdvanceY = pt2D.y;
}
示例2: extractRotation
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private static AffineTransform extractRotation(Point2D.Double pt,
AffineTransform tx, boolean andTranslation) {
tx.deltaTransform(pt, pt);
AffineTransform rtx = AffineTransform.getRotateInstance(pt.x, pt.y);
try {
AffineTransform rtxi = rtx.createInverse();
double dx = tx.getTranslateX();
double dy = tx.getTranslateY();
tx.preConcatenate(rtxi);
if (andTranslation) {
if (dx != 0 || dy != 0) {
tx.setTransform(tx.getScaleX(), tx.getShearY(),
tx.getShearX(), tx.getScaleY(), 0, 0);
rtx.setTransform(rtx.getScaleX(), rtx.getShearY(),
rtx.getShearX(), rtx.getScaleY(), dx, dy);
}
}
}
catch (NoninvertibleTransformException e) {
return null;
}
return rtx;
}
示例3: StandardGlyphVector
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public StandardGlyphVector(Font font, FontRenderContext frc, int[] glyphs, float[] positions,
int[] indices, int flags) {
initGlyphVector(font, frc, glyphs, positions, indices, flags);
// this code should go into layout
float track = getTracking(font);
if (track != 0) {
track *= font.getSize2D();
Point2D.Float trackPt = new Point2D.Float(track, 0); // advance delta
if (font.isTransformed()) {
AffineTransform at = font.getTransform();
at.deltaTransform(trackPt, trackPt);
}
// how do we know its a base glyph
// for now, it is if the natural advance of the glyph is non-zero
Font2D f2d = FontUtilities.getFont2D(font);
FontStrike strike = f2d.getStrike(font, frc);
float[] deltas = { trackPt.x, trackPt.y };
for (int j = 0; j < deltas.length; ++j) {
float inc = deltas[j];
if (inc != 0) {
float delta = 0;
for (int i = j, n = 0; n < glyphs.length; i += 2) {
if (strike.getGlyphAdvance(glyphs[n++]) != 0) { // might be an inadequate test
positions[i] += delta;
delta += inc;
}
}
positions[positions.length-2+j] += delta;
}
}
}
}
示例4: initPositions
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
/**
* Ensure that the positions array exists and holds position data.
* If the array is null, this allocates it and sets default positions.
*/
private void initPositions() {
if (positions == null) {
setFRCTX();
positions = new float[glyphs.length * 2 + 2];
Point2D.Float trackPt = null;
float track = getTracking(font);
if (track != 0) {
track *= font.getSize2D();
trackPt = new Point2D.Float(track, 0); // advance delta
}
Point2D.Float pt = new Point2D.Float(0, 0);
if (font.isTransformed()) {
AffineTransform at = font.getTransform();
at.transform(pt, pt);
positions[0] = pt.x;
positions[1] = pt.y;
if (trackPt != null) {
at.deltaTransform(trackPt, trackPt);
}
}
for (int i = 0, n = 2; i < glyphs.length; ++i, n += 2) {
getGlyphStrike(i).addDefaultGlyphAdvance(glyphs[i], pt);
if (trackPt != null) {
pt.x += trackPt.x;
pt.y += trackPt.y;
}
positions[n] = pt.x;
positions[n+1] = pt.y;
}
}
}
示例5: getNativePointSize
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
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;
}
示例6: initPositions
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
/**
* Ensure that the positions array exists and holds position data.
* If the array is null, this allocates it and sets default positions.
*/
private void initPositions() {
if (positions == null) {
positions = new float[glyphs.length() * 2 + 2];
Point2D.Float trackPt = null;
float track = getTracking(font);
if (track != 0) {
track *= font.getSize2D();
trackPt = new Point2D.Float(track, 0); // advance delta
}
Point2D.Float pt = new Point2D.Float(0, 0);
if (font.isTransformed()) {
AffineTransform at = font.getTransform();
at.transform(pt, pt);
positions[0] = pt.x;
positions[1] = pt.y;
if (trackPt != null) {
at.deltaTransform(trackPt, trackPt);
}
}
for (int i = 0, n = 2; i < glyphs.length(); ++i, n += 2) {
addDefaultGlyphAdvance(glyphs.charAt(i), pt);
if (trackPt != null) {
pt.x += trackPt.x;
pt.y += trackPt.y;
}
positions[n] = pt.x;
positions[n+1] = pt.y;
}
}
}