java.awt.geom.AffineTransform.getType()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中java.awt.geom.AffineTransform.getType()方法的一些代码示例,展示了AffineTransform.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AffineTransform.getType()方法的具体详情如下:
包路径:java.awt.geom.AffineTransform
类名称:AffineTransform
方法名:getType

AffineTransform.getType介绍

暂无

代码示例

代码示例来源:origin: plantuml/plantuml

  1. /**
  2. * Delegates to the enclosed <code>GeneralPath</code>.
  3. */
  4. public void transform(AffineTransform at) {
  5. if (at.getType() != AffineTransform.TYPE_IDENTITY) {
  6. throw new IllegalArgumentException("ExtendedGeneralPaths can not be transformed");
  7. }
  8. }

代码示例来源:origin: geotools/geotools

  1. /** Gets the flip state using standard {@code AffineTransform} API. */
  2. private static int getFlipFromType(final AffineTransform tr) {
  3. return (tr.getType() & AffineTransform.TYPE_FLIP) != 0 ? -1 : +1;
  4. }

代码示例来源:origin: org.geotools/gt2-widgets-swing

  1. /**
  2. * Indicates whether we can transform {@code shape} simply by calling its
  3. * {@code shape.setFrame(...)} method rather than by using the heavy artillery
  4. * that is the {@code transform.createTransformedShape(shape)} method.
  5. */
  6. private static boolean canReshape(final RectangularShape shape,
  7. final AffineTransform transform) {
  8. final int type=transform.getType();
  9. if ((type & AffineTransform.TYPE_GENERAL_TRANSFORM) != 0) return false;
  10. if ((type & AffineTransform.TYPE_MASK_ROTATION) != 0) return false;
  11. if ((type & AffineTransform.TYPE_FLIP) != 0) {
  12. if (shape instanceof Rectangle2D) return true;
  13. if (shape instanceof Ellipse2D) return true;
  14. if (shape instanceof RoundRectangle2D) return true;
  15. return false;
  16. }
  17. return true;
  18. }

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

  1. /**
  2. * Delegates to the enclosed <code>GeneralPath</code>.
  3. */
  4. public void transform(AffineTransform at) {
  5. if (at.getType() != AffineTransform.TYPE_IDENTITY)
  6. throw new IllegalArgumentException
  7. ("ExtendedGeneralPaths can not be transformed");
  8. }

代码示例来源:origin: net.sourceforge.plantuml/plantuml

  1. /**
  2. * Delegates to the enclosed <code>GeneralPath</code>.
  3. */
  4. public void transform(AffineTransform at) {
  5. if (at.getType() != AffineTransform.TYPE_IDENTITY) {
  6. throw new IllegalArgumentException("ExtendedGeneralPaths can not be transformed");
  7. }
  8. }

代码示例来源:origin: org.apache.xmlgraphics/batik-awt-util

  1. /**
  2. * Delegates to the enclosed <code>GeneralPath</code>.
  3. */
  4. public void transform(AffineTransform at) {
  5. if (at.getType() != AffineTransform.TYPE_IDENTITY)
  6. throw new IllegalArgumentException
  7. ("ExtendedGeneralPaths can not be transformed");
  8. }

代码示例来源:origin: apache/batik

  1. /**
  2. * Delegates to the enclosed <code>GeneralPath</code>.
  3. */
  4. public void transform(AffineTransform at) {
  5. if (at.getType() != AffineTransform.TYPE_IDENTITY)
  6. throw new IllegalArgumentException
  7. ("ExtendedGeneralPaths can not be transformed");
  8. }

代码示例来源:origin: geotools/geotools

  1. final int type = transform.getType();
  2. if (type == TYPE_IDENTITY) {
  3. return shape;

代码示例来源:origin: sc.fiji/TrakEM2_

  1. @Override
  2. protected void transformData(final AffineTransform aff) {
  3. switch (aff.getType()) {
  4. case AffineTransform.TYPE_IDENTITY:
  5. case AffineTransform.TYPE_TRANSLATION:
  6. // Radius doesn't change
  7. return;
  8. default:
  9. // Scale the radius as appropriate
  10. final double[] fp = new double[]{x, y, x + r, y};
  11. aff.transform(fp, 0, fp, 0, 2);
  12. r = (float)Math.sqrt(Math.pow(fp[2] - fp[0], 2) + Math.pow(fp[3] - fp[1], 2));
  13. }
  14. }
  15. }

代码示例来源:origin: apache/sis

  1. /**
  2. * Gets the flip state using standard {@code AffineTransform} API.
  3. */
  4. private static int getFlipFromType(final AffineTransform tr) {
  5. return (tr.getType() & AffineTransform.TYPE_FLIP) != 0 ? -1 : +1;
  6. }

代码示例来源:origin: sc.fiji/TrakEM2_

  1. /** Subclasses can override this method to provide the exact contour, otherwise it returns the transformed bounding box of the data. */
  2. public Polygon getPerimeter() {
  3. if (this.at.isIdentity() || this.at.getType() == AffineTransform.TYPE_TRANSLATION) {
  4. // return the bounding box as a polygon:
  5. final Rectangle r = getBoundingBox();
  6. return new Polygon(new int[]{r.x, r.x+r.width, r.x+r.width, r.x},
  7. new int[]{r.y, r.y, r.y+r.height, r.y+r.height},
  8. 4);
  9. }
  10. // else, the rotated/sheared/scaled and translated bounding box:
  11. final double[] po1 = new double[]{0,0, width,0, width,height, 0,height};
  12. final double[] po2 = new double[8];
  13. this.at.transform(po1, 0, po2, 0, 4);
  14. return new Polygon(new int[]{(int)po2[0], (int)po2[2], (int)po2[4], (int)po2[6]},
  15. new int[]{(int)po2[1], (int)po2[3], (int)po2[5], (int)po2[7]},
  16. 4);
  17. }

代码示例来源:origin: sc.fiji/TrakEM2_

  1. /** Returns the perimeter enlarged in all West, North, East and South directions, in pixels.*/
  2. public Polygon getPerimeter(final int w, final int n, final int e, final int s) {
  3. if (this.at.isIdentity() || this.at.getType() == AffineTransform.TYPE_TRANSLATION) {
  4. // return the bounding box as a polygon:
  5. final Rectangle r = getBoundingBox();
  6. return new Polygon(new int[]{r.x -w, r.x+r.width +w+e, r.x+r.width +w+e, r.x -w},
  7. new int[]{r.y -n, r.y -n, r.y+r.height +n+s, r.y+r.height +n+s},
  8. 4);
  9. }
  10. // else, the rotated/sheared/scaled and translated bounding box:
  11. final double[] po1 = new double[]{-w,-n, width+w+e,-n, width+w+e,height+n+s, -w,height+n+s};
  12. final double[] po2 = new double[8];
  13. this.at.transform(po1, 0, po2, 0, 4);
  14. return new Polygon(new int[]{(int)po2[0], (int)po2[2], (int)po2[4], (int)po2[6]},
  15. new int[]{(int)po2[1], (int)po2[3], (int)po2[5], (int)po2[7]},
  16. 4);
  17. }

代码示例来源:origin: sc.fiji/TrakEM2_

  1. @Override
  2. public Polygon getPerimeter() {
  3. if (this.at.isIdentity() || this.at.getType() == AffineTransform.TYPE_TRANSLATION) {
  4. // return the bounding box as a polygon:
  5. final Rectangle r = getBoundingBox();
  6. return new Polygon(new int[]{r.x, r.x+r.width, r.x+r.width, r.x},
  7. new int[]{r.y, r.y, r.y+r.height, r.y+r.height},
  8. 4);
  9. }
  10. // else, the rotated/sheared/scaled and translated bounding box:
  11. final double[] po1 = new double[]{0,0, width,0, width,-height, 0,-height};
  12. final double[] po2 = new double[8];
  13. this.at.transform(po1, 0, po2, 0, 4);
  14. return new Polygon(new int[]{(int)po2[0], (int)po2[2], (int)po2[4], (int)po2[6]},
  15. new int[]{(int)po2[1], (int)po2[3], (int)po2[5], (int)po2[7]},
  16. 4);
  17. }

代码示例来源:origin: sc.fiji/TrakEM2_

  1. /** Returns the perimeter enlarged in all West, North, East and South directions, in pixels.*/
  2. @Override
  3. public Polygon getPerimeter(final int w, final int n, final int e, final int s) {
  4. if (this.at.isIdentity() || this.at.getType() == AffineTransform.TYPE_TRANSLATION) {
  5. // return the bounding box as a polygon:
  6. final Rectangle r = getBoundingBox();
  7. return new Polygon(new int[]{r.x -w, r.x+r.width +w+e, r.x+r.width +w+e, r.x -w},
  8. new int[]{r.y -n, r.y -n, r.y+r.height +n+s, r.y+r.height +n+s},
  9. 4);
  10. }
  11. // else, the rotated/sheared/scaled and translated bounding box:
  12. final double[] po1 = new double[]{-w,-n, width+w+e,-n, width+w+e,-height+n+s, -w,-height+n+s};
  13. final double[] po2 = new double[8];
  14. this.at.transform(po1, 0, po2, 0, 4);
  15. return new Polygon(new int[]{(int)po2[0], (int)po2[2], (int)po2[4], (int)po2[6]},
  16. new int[]{(int)po2[1], (int)po2[3], (int)po2[5], (int)po2[7]},
  17. 4);
  18. }

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

  1. public static void dumpHintsAndScale(final Graphics2D g2d) {
  2. final RenderingHints rHints = g2d.getRenderingHints();
  3. final Set<Entry<Object, Object>> rEntries = rHints.entrySet();
  4. int count = 0;
  5. for(final Iterator<Entry<Object, Object>> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) {
  6. final Entry<Object, Object> rEntry = rEntryIter.next();
  7. System.err.println("Hint["+count+"]: "+rEntry.getKey()+" -> "+rEntry.getValue());
  8. }
  9. final AffineTransform aTrans = g2d.getTransform();
  10. if( null != aTrans ) {
  11. System.err.println(" type "+aTrans.getType());
  12. System.err.println(" scale "+aTrans.getScaleX()+" x "+aTrans.getScaleY());
  13. System.err.println(" move "+aTrans.getTranslateX()+" x "+aTrans.getTranslateY());
  14. System.err.println(" mat "+aTrans);
  15. } else {
  16. System.err.println(" null transform");
  17. }
  18. }

代码示例来源:origin: nroduit/Weasis

  1. /**
  2. * Extract rotation Angle from a given AffineTransform Matrix.<br>
  3. * This function handle cases of mirror image flip about some axis. This changes right handed coordinate system into
  4. * a left handed system. Hence, returned angle has an opposite value.
  5. *
  6. * @param transform
  7. * @return angle in the range of [ -PI ; PI ]
  8. */
  9. public static double extractAngleRad(AffineTransform transform) {
  10. double angleRad = 0.0;
  11. if (transform != null) {
  12. double sinTheta = transform.getShearY();
  13. double cosTheta = transform.getScaleX();
  14. angleRad = Math.atan2(sinTheta, cosTheta);
  15. if ((transform.getType() & AffineTransform.TYPE_FLIP) != 0) {
  16. angleRad *= -1.0;
  17. }
  18. }
  19. return angleRad;
  20. }

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

  1. @Override
  2. public void transform(AffineTransform tx) {
  3. if (get(TRANSFORM) != null
  4. || (tx.getType() & (AffineTransform.TYPE_TRANSLATION)) != tx.getType()) {
  5. if (get(TRANSFORM) == null) {
  6. TRANSFORM.setClone(this, tx);
  7. } else {
  8. AffineTransform t = TRANSFORM.getClone(this);
  9. t.preConcatenate(tx);
  10. set(TRANSFORM, t);
  11. }
  12. } else {
  13. super.transform(tx);
  14. }
  15. }

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

  1. @Override
  2. public void transform(AffineTransform tx) {
  3. if (get(TRANSFORM) != null ||
  4. (tx.getType() & (AffineTransform.TYPE_TRANSLATION)) != tx.getType()) {
  5. if (get(TRANSFORM) == null) {
  6. TRANSFORM.setClone(this, tx);
  7. } else {
  8. AffineTransform t = TRANSFORM.getClone(this);
  9. t.preConcatenate(tx);
  10. set(TRANSFORM, t);
  11. }
  12. } else {
  13. super.transform(tx);
  14. }
  15. }

代码示例来源:origin: robo-code/robocode

  1. private void put(AffineTransform tx) {
  2. if (tx == null) {
  3. put((byte) 0);
  4. } else {
  5. double[] m = new double[6];
  6. tx.getMatrix(m);
  7. put((byte) 1);
  8. put(m);
  9. put(tx.getType());
  10. }
  11. }

代码示例来源:origin: triplea-game/triplea

  1. private static Predicate<AffineTransform> transCriteria(final int xoffset, final int yoffset) {
  2. return trans -> trans.getTranslateX() == xoffset
  3. && trans.getTranslateY() == yoffset
  4. && trans.getType() == AffineTransform.TYPE_TRANSLATION;
  5. }
  6. }

相关文章