本文整理了Java中java.awt.geom.AffineTransform.getQuadrantRotateInstance()
方法的一些代码示例,展示了AffineTransform.getQuadrantRotateInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AffineTransform.getQuadrantRotateInstance()
方法的具体详情如下:
包路径:java.awt.geom.AffineTransform
类名称:AffineTransform
方法名:getQuadrantRotateInstance
暂无
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testFilterRotateBIStandard() {
BufferedImageOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
BufferedImageOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
for (Integer type : TYPES) {
BufferedImage image = new BufferedImage(width, height, type);
BufferedImage jreResult = jreOp.filter(image, null);
BufferedImage tmResult = tmOp.filter(image, null);
assertNotNull("No result!", tmResult);
assertEquals("Bad type", jreResult.getType(), tmResult.getType());
assertEquals("Incorrect color model", jreResult.getColorModel(), tmResult.getColorModel());
assertEquals("Incorrect width", jreResult.getWidth(), tmResult.getWidth());
assertEquals("Incorrect height", jreResult.getHeight(), tmResult.getHeight());
}
}
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testFilterRotateRasterStandard() {
RasterOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
RasterOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testFilterRotateRasterCustom() {
RasterOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
RasterOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
代码示例来源:origin: haraldk/TwelveMonkeys
@Test
public void testFilterRotateBICustom() {
BufferedImageOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
BufferedImageOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
for (ImageTypeSpecifier spec : SPECS) {
BufferedImage image = spec.createBufferedImage(width, height);
BufferedImage tmResult = tmOp.filter(image, null);
assertNotNull("No result!", tmResult);
BufferedImage jreResult = null;
try {
jreResult = jreOp.filter(image, null);
}
catch (ImagingOpException ignore) {
// We expect this to fail for certain cases, that's why we crated the class in the first place
}
if (jreResult != null) {
assertEquals("Bad type", jreResult.getType(), tmResult.getType());
assertEquals("Incorrect color model", jreResult.getColorModel(), tmResult.getColorModel());
assertEquals("Incorrect width", jreResult.getWidth(), tmResult.getWidth());
assertEquals("Incorrect height", jreResult.getHeight(), tmResult.getHeight());
}
else {
assertEquals("Bad type", spec.getBufferedImageType(), tmResult.getType());
assertEquals("Incorrect color model", spec.getColorModel(), tmResult.getColorModel());
assertEquals("Incorrect width", height, tmResult.getWidth());
assertEquals("Incorrect height", width, tmResult.getHeight());
}
}
}
代码示例来源:origin: ribomation/DroidAtScreen1
BufferedImage rotate(int quadrants, BufferedImage img) {
int w = img.getWidth();
int h = img.getHeight();
int x = (quadrants == 2 || quadrants == 3) ? w : 0;
int y = (quadrants == 1 || quadrants == 2) ? h : 0;
Point2D origo = AffineTransform.getQuadrantRotateInstance(quadrants, 0, 0).transform(new Point(x, y), null);
BufferedImage result = new BufferedImage(h, w, img.getType());
Graphics2D g = result.createGraphics();
g.translate(0 - origo.getX(), 0 - origo.getY());
g.transform(AffineTransform.getQuadrantRotateInstance(quadrants, 0, 0));
g.drawRenderedImage(img, null);
return result;
}
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
private BufferedImage getRotatedImage(BufferedImage gray) throws IOException
{
BufferedImage gray2;
AffineTransform at;
switch (pageRotation % 360)
{
case 90:
gray2 = new BufferedImage(gray.getHeight(), gray.getWidth(), BufferedImage.TYPE_BYTE_GRAY);
at = AffineTransform.getQuadrantRotateInstance(1, gray.getHeight() / 2d, gray.getHeight() / 2d);
break;
case 180:
gray2 = new BufferedImage(gray.getWidth(), gray.getHeight(), BufferedImage.TYPE_BYTE_GRAY);
at = AffineTransform.getQuadrantRotateInstance(2, gray.getWidth()/ 2d, gray.getHeight() / 2d);
break;
case 270:
gray2 = new BufferedImage(gray.getHeight(), gray.getWidth(), BufferedImage.TYPE_BYTE_GRAY);
at = AffineTransform.getQuadrantRotateInstance(3, gray.getWidth()/ 2d, gray.getWidth() / 2d);
break;
default:
return gray;
}
Graphics2D g2 = (Graphics2D) gray2.getGraphics();
g2.drawImage(gray, at, null);
g2.dispose();
return gray2;
}
代码示例来源:origin: stackoverflow.com
import java.io.File;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.AffineTransformOp;
import java.awt.geom.AffineTransform;
class RT {
public static void main(String[] args) throws java.io.IOException {
BufferedImage img = ImageIO.read(new File("input-image.png"));
BufferedImage rotated = new AffineTransformOp(
AffineTransform.getQuadrantRotateInstance(
3, img.getWidth() / 2, img.getHeight() / 2),
AffineTransformOp.TYPE_BILINEAR).filter(img, null);
ImageIO.write(rotated, "PNG", new File("output-image.png"));
}
}
代码示例来源:origin: apache/pdfbox
form.setMatrix(AffineTransform.getQuadrantRotateInstance(1));
initialScale = Matrix.getScaleInstance(bbox.getWidth() / bbox.getHeight(), bbox.getHeight() / bbox.getWidth());
height = bbox.getWidth();
break;
case 180:
form.setMatrix(AffineTransform.getQuadrantRotateInstance(2));
break;
case 270:
form.setMatrix(AffineTransform.getQuadrantRotateInstance(3));
initialScale = Matrix.getScaleInstance(bbox.getWidth() / bbox.getHeight(), bbox.getHeight() / bbox.getWidth());
height = bbox.getWidth();
代码示例来源:origin: com.synaptix/SynaptixWidget
@Override
protected void paintComponent(Graphics g) {
Graphics2D gr = (Graphics2D) g.create();
if (direction == SwingConstants.LEFT || direction == SwingConstants.RIGHT) {
gr.translate(0, getSize().getHeight());
gr.transform(AffineTransform.getQuadrantRotateInstance(-1));
needsRotate = true;
}
super.paintComponent(gr);
needsRotate = false;
gr.dispose();
}
}
代码示例来源:origin: com.synaptix/SynaptixSwing
@Override
protected void paintComponent(Graphics g) {
Graphics2D gr = (Graphics2D) g.create();
switch (direction) {
case VERTICAL_UP:
gr.translate(0, getSize().getHeight());
gr.transform(AffineTransform.getQuadrantRotateInstance(-1));
break;
case VERTICAL_DOWN:
gr.transform(AffineTransform.getQuadrantRotateInstance(1));
gr.translate(0, -getSize().getWidth());
break;
default:
}
needsRotate = true;
super.paintComponent(gr);
needsRotate = false;
}
}
代码示例来源:origin: ribomation/DroidAtScreen1
double x = (landscapeMode ? h : w) / 2;
double y = (landscapeMode ? w : h) / 2;
TX.concatenate(AffineTransform.getQuadrantRotateInstance(2, x, y));
代码示例来源:origin: opengeospatial/geoapi
/**
* Tests using a 180° rotation in a two-dimensional space.
*
* @throws FactoryException should never happen.
* @throws TransformException should never happen.
*/
@Test
public void testSouthOrientated2D() throws FactoryException, TransformException {
runTest(AffineTransform.getQuadrantRotateInstance(2));
assertFalse("MathTransform.isIdentity().", transform.isIdentity());
}
代码示例来源:origin: igvteam/igv
transform = AffineTransform.getQuadrantRotateInstance(-1);
graphics2.transform(transform);
graphics2.setFont(font);
代码示例来源:origin: com.twelvemonkeys.common/common-image
@Test
public void testFilterRotateBIStandard() {
BufferedImageOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
BufferedImageOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
for (Integer type : TYPES) {
BufferedImage image = new BufferedImage(width, height, type);
BufferedImage jreResult = jreOp.filter(image, null);
BufferedImage tmResult = tmOp.filter(image, null);
assertNotNull("No result!", tmResult);
assertEquals("Bad type", jreResult.getType(), tmResult.getType());
assertEquals("Incorrect color model", jreResult.getColorModel(), tmResult.getColorModel());
assertEquals("Incorrect width", jreResult.getWidth(), tmResult.getWidth());
assertEquals("Incorrect height", jreResult.getHeight(), tmResult.getHeight());
}
}
代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-image
@Test
public void testFilterRotateBIStandard() {
BufferedImageOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
BufferedImageOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
for (Integer type : TYPES) {
BufferedImage image = new BufferedImage(width, height, type);
BufferedImage jreResult = jreOp.filter(image, null);
BufferedImage tmResult = tmOp.filter(image, null);
assertNotNull("No result!", tmResult);
assertEquals("Bad type", jreResult.getType(), tmResult.getType());
assertEquals("Incorrect color model", jreResult.getColorModel(), tmResult.getColorModel());
assertEquals("Incorrect width", jreResult.getWidth(), tmResult.getWidth());
assertEquals("Incorrect height", jreResult.getHeight(), tmResult.getHeight());
}
}
代码示例来源:origin: com.twelvemonkeys.common/common-image
@Test
public void testFilterRotateRasterStandard() {
RasterOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
RasterOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-image
@Test
public void testFilterRotateRasterStandard() {
RasterOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
RasterOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
代码示例来源:origin: com.twelvemonkeys.common/common-image
@Test
public void testFilterRotateRasterCustom() {
RasterOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
RasterOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-image
@Test
public void testFilterRotateBICustom() {
BufferedImageOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
BufferedImageOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
for (ImageTypeSpecifier spec : SPECS) {
BufferedImage image = spec.createBufferedImage(width, height);
BufferedImage tmResult = tmOp.filter(image, null);
assertNotNull("No result!", tmResult);
BufferedImage jreResult = null;
try {
jreResult = jreOp.filter(image, null);
}
catch (ImagingOpException ignore) {
// We expect this to fail for certain cases, that's why we crated the class in the first place
}
if (jreResult != null) {
assertEquals("Bad type", jreResult.getType(), tmResult.getType());
assertEquals("Incorrect color model", jreResult.getColorModel(), tmResult.getColorModel());
assertEquals("Incorrect width", jreResult.getWidth(), tmResult.getWidth());
assertEquals("Incorrect height", jreResult.getHeight(), tmResult.getHeight());
}
else {
assertEquals("Bad type", spec.getBufferedImageType(), tmResult.getType());
assertEquals("Incorrect color model", spec.getColorModel(), tmResult.getColorModel());
assertEquals("Incorrect width", height, tmResult.getWidth());
assertEquals("Incorrect height", width, tmResult.getHeight());
}
}
}
代码示例来源:origin: com.twelvemonkeys.common/common-image
@Test
public void testFilterRotateBICustom() {
BufferedImageOp jreOp = new java.awt.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
BufferedImageOp tmOp = new com.twelvemonkeys.image.AffineTransformOp(AffineTransform.getQuadrantRotateInstance(1, Math.min(width, height) / 2, Math.min(width, height) / 2), null);
for (ImageTypeSpecifier spec : SPECS) {
BufferedImage image = spec.createBufferedImage(width, height);
BufferedImage tmResult = tmOp.filter(image, null);
assertNotNull("No result!", tmResult);
BufferedImage jreResult = null;
try {
jreResult = jreOp.filter(image, null);
}
catch (ImagingOpException ignore) {
// We expect this to fail for certain cases, that's why we crated the class in the first place
}
if (jreResult != null) {
assertEquals("Bad type", jreResult.getType(), tmResult.getType());
assertEquals("Incorrect color model", jreResult.getColorModel(), tmResult.getColorModel());
assertEquals("Incorrect width", jreResult.getWidth(), tmResult.getWidth());
assertEquals("Incorrect height", jreResult.getHeight(), tmResult.getHeight());
}
else {
assertEquals("Bad type", spec.getBufferedImageType(), tmResult.getType());
assertEquals("Incorrect color model", spec.getColorModel(), tmResult.getColorModel());
assertEquals("Incorrect width", height, tmResult.getWidth());
assertEquals("Incorrect height", width, tmResult.getHeight());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!