本文整理汇总了Java中java.awt.geom.AffineTransform.getScaleY方法的典型用法代码示例。如果您正苦于以下问题:Java AffineTransform.getScaleY方法的具体用法?Java AffineTransform.getScaleY怎么用?Java AffineTransform.getScaleY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.AffineTransform
的用法示例。
在下文中一共展示了AffineTransform.getScaleY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBackupSurface
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
/**
* Creates a software-based surface (of type BufImgSurfaceData).
* The software representation is only created when needed, which
* is only during some situation in which the hardware surface
* cannot be allocated. This allows apps to at least run,
* albeit more slowly than they would otherwise.
*/
protected SurfaceData getBackupSurface() {
if (sdBackup == null) {
GraphicsConfiguration gc = vImg.getGraphicsConfig();
AffineTransform tx = gc.getDefaultTransform();
double scaleX = tx.getScaleX();
double scaleY = tx.getScaleY();
BufferedImage bImg = vImg.getBackupImage(scaleX, scaleY);
// Sabotage the acceleration capabilities of the BufImg surface
SunWritableRaster.stealTrackable(bImg
.getRaster()
.getDataBuffer()).setUntrackable();
sdBackup = BufImgSurfaceData.createData(bImg, scaleX, scaleY);
}
return sdBackup;
}
示例2: testScale
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private static void testScale(double scaleX, double scaleY) {
Dialog dialog = new Dialog((Frame) null, true) {
@Override
public void paint(Graphics g) {
super.paint(g);
AffineTransform tx = ((Graphics2D) g).getTransform();
dispose();
if (scaleX != tx.getScaleX() || scaleY != tx.getScaleY()) {
throw new RuntimeException(String.format("Wrong scale:"
+ "[%f, %f] instead of [%f, %f].",
tx.getScaleX(), tx.getScaleY(), scaleX, scaleY));
}
}
};
dialog.setSize(200, 300);
dialog.setVisible(true);
}
示例3: inverseDeltaTransformConsumer
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static PathConsumer2D
inverseDeltaTransformConsumer(PathConsumer2D out,
AffineTransform at)
{
if (at == null) {
return out;
}
float Mxx = (float) at.getScaleX();
float Mxy = (float) at.getShearX();
float Myx = (float) at.getShearY();
float Myy = (float) at.getScaleY();
if (Mxy == 0f && Myx == 0f) {
if (Mxx == 1f && Myy == 1f) {
return out;
} else {
return new DeltaScaleFilter(out, 1.0f/Mxx, 1.0f/Myy);
}
} else {
float det = Mxx * Myy - Mxy * Myx;
return new DeltaTransformFilter(out,
Myy / det,
-Mxy / det,
-Myx / det,
Mxx / det);
}
}
示例4: inverseDeltaTransformConsumer
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
DPathConsumer2D inverseDeltaTransformConsumer(DPathConsumer2D out,
AffineTransform at)
{
if (at == null) {
return out;
}
double mxx = at.getScaleX();
double mxy = at.getShearX();
double myx = at.getShearY();
double myy = at.getScaleY();
if (mxy == 0.0d && myx == 0.0d) {
if (mxx == 1.0d && myy == 1.0d) {
return out;
} else {
return iv_DeltaScaleFilter.init(out, 1.0d/mxx, 1.0d/myy);
}
} else {
double det = mxx * myy - mxy * myx;
return iv_DeltaTransformFilter.init(out,
myy / det,
-mxy / det,
-myx / det,
mxx / det);
}
}
示例5: inverseDeltaTransformConsumer
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
PathConsumer2D inverseDeltaTransformConsumer(PathConsumer2D out,
AffineTransform at)
{
if (at == null) {
return out;
}
float mxx = (float) at.getScaleX();
float mxy = (float) at.getShearX();
float myx = (float) at.getShearY();
float myy = (float) at.getScaleY();
if (mxy == 0.0f && myx == 0.0f) {
if (mxx == 1.0f && myy == 1.0f) {
return out;
} else {
return iv_DeltaScaleFilter.init(out, 1.0f/mxx, 1.0f/myy);
}
} else {
float det = mxx * myy - mxy * myx;
return iv_DeltaTransformFilter.init(out,
myy / det,
-mxy / det,
-myx / det,
mxx / det);
}
}
示例6: concatfix
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public void concatfix(AffineTransform at) {
double m00 = at.getScaleX();
double m10 = at.getShearY();
double m01 = at.getShearX();
double m11 = at.getScaleY();
double m02 = at.getTranslateX();
double m12 = at.getTranslateY();
if (Math.abs(m00-1.0) < 1E-10) m00 = 1.0;
if (Math.abs(m11-1.0) < 1E-10) m11 = 1.0;
if (Math.abs(m02) < 1E-10) m02 = 0.0;
if (Math.abs(m12) < 1E-10) m12 = 0.0;
if (Math.abs(m01) < 1E-15) m01 = 0.0;
if (Math.abs(m10) < 1E-15) m10 = 0.0;
at.setTransform(m00, m10,
m01, m11,
m02, m12);
}
示例7: initScreenBounds
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
static void initScreenBounds() {
GraphicsDevice[] devices = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getScreenDevices();
screenBounds = new Rectangle[devices.length];
scales = new double[devices.length][2];
for (int i = 0; i < devices.length; i++) {
GraphicsConfiguration gc = devices[i].getDefaultConfiguration();
screenBounds[i] = gc.getBounds();
AffineTransform tx = gc.getDefaultTransform();
scales[i][0] = tx.getScaleX();
scales[i][1] = tx.getScaleY();
}
for (int i = 0; i < devices.length; i++) {
for (int j = i + 1; j < devices.length; j++) {
if (scales[i][0] != scales[j][0] || scales[i][1] != scales[j][1]) {
screen1 = i;
screen2 = j;
}
}
}
}
示例8: setBounds
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
@Override
public void setBounds(int x, int y, int width, int height, int op) {
sysX = x;
sysY = y;
sysW = width;
sysH = height;
int cx = x + width / 2;
int cy = y + height / 2;
GraphicsConfiguration current = getGraphicsConfiguration();
GraphicsConfiguration other = SwingUtilities2.getGraphicsConfigurationAtPoint(current, cx, cy);
if (!current.equals(other)) {
AffineTransform tx = other.getDefaultTransform();
double otherScaleX = tx.getScaleX();
double otherScaleY = tx.getScaleY();
initScales();
if (scaleX != otherScaleX || scaleY != otherScaleY) {
x = (int) Math.floor(x * otherScaleX / scaleX);
y = (int) Math.floor(y * otherScaleY / scaleY);
}
}
super.setBounds(x, y, width, height, op);
}
示例9: isIdentity
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public static boolean isIdentity(AffineTransform at) {
return (at.getScaleX() == 1 &&
at.getScaleY() == 1 &&
at.getShearX() == 0 &&
at.getShearY() == 0 &&
at.getTranslateX() == 0 &&
at.getTranslateY() == 0);
}
示例10: matchTX
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private static boolean matchTX(double[] lhs, AffineTransform rhs) {
return
lhs[0] == rhs.getScaleX() &&
lhs[1] == rhs.getShearY() &&
lhs[2] == rhs.getShearX() &&
lhs[3] == rhs.getScaleY();
}
示例11: 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;
}
示例12: fillRectangle
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
public void fillRectangle(SunGraphics2D sg2d,
double rx, double ry,
double rw, double rh)
{
double px, py;
double dx1, dy1, dx2, dy2;
AffineTransform txform = sg2d.transform;
dx1 = txform.getScaleX();
dy1 = txform.getShearY();
dx2 = txform.getShearX();
dy2 = txform.getScaleY();
px = rx * dx1 + ry * dx2 + txform.getTranslateX();
py = rx * dy1 + ry * dy2 + txform.getTranslateY();
dx1 *= rw;
dy1 *= rw;
dx2 *= rh;
dy2 *= rh;
if (adjustfill &&
sg2d.strokeState < SunGraphics2D.STROKE_CUSTOM &&
sg2d.strokeHint != SunHints.INTVAL_STROKE_PURE)
{
double newx = normalize(px);
double newy = normalize(py);
dx1 = normalize(px + dx1) - newx;
dy1 = normalize(py + dy1) - newy;
dx2 = normalize(px + dx2) - newx;
dy2 = normalize(py + dy2) - newy;
px = newx;
py = newy;
}
outrenderer.fillParallelogram(sg2d, rx, ry, rx+rw, ry+rh,
px, py, dx1, dy1, dx2, dy2);
}
示例13: isPixelsCopying
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private boolean isPixelsCopying(JComponent c, Graphics g) {
AffineTransform tx = getTransform(g);
GraphicsConfiguration gc = c.getGraphicsConfiguration();
if (tx == null || gc == null
|| !SwingUtilities2.isFloatingPointScale(tx)) {
return false;
}
AffineTransform gcTx = gc.getDefaultTransform();
return gcTx.getScaleX() == tx.getScaleX()
&& gcTx.getScaleY() == tx.getScaleY();
}
示例14: getPixelColor
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
/**
* Returns the color of a pixel at the given screen coordinates.
* @param x X position of pixel
* @param y Y position of pixel
* @return Color of the pixel
*/
public synchronized Color getPixelColor(int x, int y) {
AffineTransform tx = GraphicsEnvironment.
getLocalGraphicsEnvironment().getDefaultScreenDevice().
getDefaultConfiguration().getDefaultTransform();
x = (int) (x * tx.getScaleX());
y = (int) (y * tx.getScaleY());
Color color = new Color(peer.getRGBPixel(x, y));
return color;
}
示例15: paintDoubleBufferedFPScales
import java.awt.geom.AffineTransform; //导入方法依赖的package包/类
private void paintDoubleBufferedFPScales(JComponent c, Image image,
Graphics g, int clipX, int clipY,
int clipW, int clipH) {
Graphics osg = image.getGraphics();
Graphics2D g2d = (Graphics2D) g;
Graphics2D osg2d = (Graphics2D) osg;
AffineTransform identity = new AffineTransform();
int bw = Math.min(clipW, image.getWidth(null));
int bh = Math.min(clipH, image.getHeight(null));
int x, y, maxx, maxy;
AffineTransform tx = g2d.getTransform();
double scaleX = tx.getScaleX();
double scaleY = tx.getScaleY();
double trX = tx.getTranslateX();
double trY = tx.getTranslateY();
boolean translucent = volatileBufferType != Transparency.OPAQUE;
Composite oldComposite = g2d.getComposite();
try {
for (x = clipX, maxx = clipX + clipW; x < maxx; x += bw) {
for (y = clipY, maxy = clipY + clipH; y < maxy; y += bh) {
// draw x, y, bw, bh
int pixelx1 = Region.clipRound(x * scaleX + trX);
int pixely1 = Region.clipRound(y * scaleY + trY);
int pixelx2 = Region.clipRound((x + bw) * scaleX + trX);
int pixely2 = Region.clipRound((y + bh) * scaleY + trY);
int pixelw = pixelx2 - pixelx1;
int pixelh = pixely2 - pixely1;
osg2d.setTransform(identity);
if (translucent) {
final Color oldBg = g2d.getBackground();
g2d.setBackground(c.getBackground());
g2d.clearRect(pixelx1, pixely1, pixelw, pixelh);
g2d.setBackground(oldBg);
}
osg2d.setClip(0, 0, pixelw, pixelh);
osg2d.translate(trX - pixelx1, trY - pixely1);
osg2d.scale(scaleX, scaleY);
c.paintToOffscreen(osg, x, y, bw, bh, maxx, maxy);
g2d.setTransform(identity);
g2d.setClip(pixelx1, pixely1, pixelw, pixelh);
AffineTransform stx = new AffineTransform();
stx.translate(pixelx1, pixely1);
stx.scale(scaleX, scaleY);
g2d.setTransform(stx);
if (translucent) {
g2d.setComposite(AlphaComposite.Src);
}
g2d.drawImage(image, 0, 0, c);
if (translucent) {
g2d.setComposite(oldComposite);
}
g2d.setTransform(tx);
}
}
} finally {
osg.dispose();
}
}