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

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

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

AffineTransform.getMatrix介绍

暂无

代码示例

代码示例来源:origin: org.apache.commons/commons-math3

  1. /** Get a {@link org.apache.commons.math3.geometry.partitioning.Transform
  2. * Transform} embedding an affine transform.
  3. * @param transform affine transform to embed (must be inversible
  4. * otherwise the {@link
  5. * org.apache.commons.math3.geometry.partitioning.Transform#apply(Hyperplane)
  6. * apply(Hyperplane)} method would work only for some lines, and
  7. * fail for other ones)
  8. * @return a new transform that can be applied to either {@link
  9. * Vector2D Vector2D}, {@link Line Line} or {@link
  10. * org.apache.commons.math3.geometry.partitioning.SubHyperplane
  11. * SubHyperplane} instances
  12. * @exception MathIllegalArgumentException if the transform is non invertible
  13. * @deprecated as of 3.6, replaced with {@link #getTransform(double, double, double, double, double, double)}
  14. */
  15. @Deprecated
  16. public static Transform<Euclidean2D, Euclidean1D> getTransform(final AffineTransform transform)
  17. throws MathIllegalArgumentException {
  18. final double[] m = new double[6];
  19. transform.getMatrix(m);
  20. return new LineTransform(m[0], m[1], m[2], m[3], m[4], m[5]);
  21. }

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

  1. /**
  2. * Writes an AffineTransform to the content stream as an array.
  3. */
  4. private void writeAffineTransform(AffineTransform transform) throws IOException
  5. {
  6. double[] values = new double[6];
  7. transform.getMatrix(values);
  8. for (double v : values)
  9. {
  10. writeOperand((float) v);
  11. }
  12. }

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

  1. private COSStream createOverlayStream(PDPage page, LayoutPage layoutPage, COSName xObjectId)
  2. throws IOException
  3. {
  4. // create a new content stream that executes the XObject content
  5. StringBuilder overlayStream = new StringBuilder();
  6. overlayStream.append("q\nq\n");
  7. AffineTransform at = calculateAffineTransform(page, layoutPage.overlayMediaBox);
  8. double[] flatmatrix = new double[6];
  9. at.getMatrix(flatmatrix);
  10. for (double v : flatmatrix)
  11. {
  12. overlayStream.append(float2String((float) v));
  13. overlayStream.append(" ");
  14. }
  15. overlayStream.append(" cm\n/");
  16. overlayStream.append(xObjectId.getName());
  17. overlayStream.append(" Do Q\nQ\n");
  18. return createStream(overlayStream.toString());
  19. }

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

  1. /**
  2. * Sets the optional Matrix entry for the Pattern.
  3. * @param transform the transformation matrix
  4. */
  5. public void setMatrix(AffineTransform transform)
  6. {
  7. COSArray matrix = new COSArray();
  8. double[] values = new double[6];
  9. transform.getMatrix(values);
  10. for (double v : values)
  11. {
  12. matrix.add(new COSFloat((float)v));
  13. }
  14. getCOSObject().setItem(COSName.MATRIX, matrix);
  15. }

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

  1. /**
  2. * Sets the optional Matrix entry for the form XObject.
  3. * @param transform the transformation matrix
  4. */
  5. public void setMatrix(AffineTransform transform)
  6. {
  7. COSArray matrix = new COSArray();
  8. double[] values = new double[6];
  9. transform.getMatrix(values);
  10. for (double v : values)
  11. {
  12. matrix.add(new COSFloat((float) v));
  13. }
  14. getCOSObject().setItem(COSName.MATRIX, matrix);
  15. }

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

  1. /**
  2. * Sets the optional Matrix entry for the function based shading.
  3. *
  4. * @param transform the transformation matrix
  5. */
  6. public void setMatrix(AffineTransform transform)
  7. {
  8. COSArray matrix = new COSArray();
  9. double[] values = new double[6];
  10. transform.getMatrix(values);
  11. for (double v : values)
  12. {
  13. matrix.add(new COSFloat((float) v));
  14. }
  15. getCOSObject().setItem(COSName.MATRIX, matrix);
  16. }

代码示例来源:origin: org.apache.xmlgraphics/xmlgraphics-commons

  1. public static TransformStackElement createGeneralTransformElement(
  2. AffineTransform txf) {
  3. double[] matrix = new double[6];
  4. txf.getMatrix(matrix);
  5. return new TransformStackElement(TransformType.GENERAL, matrix) {
  6. boolean isIdentity(double[] m) {
  7. return (m[0] == 1 && m[2] == 0 && m[4] == 0
  8. && m[1] == 0 && m[3] == 1 && m[5] == 0);
  9. }
  10. };
  11. }

代码示例来源:origin: danfickle/openhtmltopdf

  1. private AffineTransform normalizeTransform(AffineTransform transform) {
  2. double[] mx = new double[6];
  3. transform.getMatrix(mx);
  4. mx[4] /= _dotsPerPoint;
  5. mx[5] /= _dotsPerPoint;
  6. return new AffineTransform(mx);
  7. }

代码示例来源:origin: danfickle/openhtmltopdf

  1. private AffineTransform normalizeTransform(AffineTransform transform) {
  2. double[] mx = new double[6];
  3. transform.getMatrix(mx);
  4. mx[4] /= _dotsPerPoint;
  5. mx[5] /= _dotsPerPoint;
  6. return new AffineTransform(mx);
  7. }

代码示例来源:origin: com.itextpdf/itextpdf

  1. protected AffineTransform normalizeMatrix() {
  2. double[] mx = new double[6];
  3. AffineTransform result = AffineTransform.getTranslateInstance(0,0);
  4. result.getMatrix(mx);
  5. mx[3]=-1;
  6. mx[5]=height;
  7. result = new AffineTransform(mx);
  8. result.concatenate(transform);
  9. return result;
  10. }

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

  1. /**
  2. * Multiplies two 2x3 matrices of double precision values
  3. */
  4. private double[] matrixMultiply(double[] matrix1, double[] matrix2) {
  5. double[] product = new double[6];
  6. AffineTransform transform1 = new AffineTransform(matrix1);
  7. transform1.concatenate(new AffineTransform(matrix2));
  8. transform1.getMatrix(product);
  9. return product;
  10. }

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf-itext

  1. private AffineTransform normalizeMatrix() {
  2. double[] mx = new double[6];
  3. AffineTransform result = AffineTransform.getTranslateInstance(0,0);
  4. result.getMatrix(mx);
  5. mx[3]=-1;
  6. mx[5]=height;
  7. result = new AffineTransform(mx);
  8. result.concatenate(transform);
  9. return result;
  10. }

代码示例来源:origin: org.apache.xmlgraphics/xmlgraphics-commons

  1. /**
  2. * Multiplies two 2x3 matrices of double precision values
  3. */
  4. private double[] matrixMultiply(double[] matrix1, double[] matrix2) {
  5. double[] product = new double[6];
  6. AffineTransform transform1 = new AffineTransform(matrix1);
  7. transform1.concatenate(new AffineTransform(matrix2));
  8. transform1.getMatrix(product);
  9. return product;
  10. }

代码示例来源:origin: org.apache.pdfbox/pdfbox

  1. /**
  2. * Writes an AffineTransform to the content stream as an array.
  3. */
  4. private void writeAffineTransform(AffineTransform transform) throws IOException
  5. {
  6. double[] values = new double[6];
  7. transform.getMatrix(values);
  8. for (double v : values)
  9. {
  10. writeOperand((float) v);
  11. }
  12. }

代码示例来源:origin: guru.nidi.com.kitfox/svgSalamander

  1. @Override
  2. public boolean getValue(StyleAttribute attrib, double curTime) throws SVGException
  3. {
  4. AffineTransform retVal = new AffineTransform();
  5. retVal = getValue(retVal, curTime);
  6. // AffineTransform val = getValue(curTime);
  7. // if (val == null) return false;
  8. double[] mat = new double[6];
  9. retVal.getMatrix(mat);
  10. attrib.setStringValue("matrix(" + mat[0] + " " + mat[1] + " " + mat[2] + " " + mat[3] + " " + mat[4] + " " + mat[5] + ")");
  11. return true;
  12. }

代码示例来源:origin: com.itextpdf/itextpdf

  1. /**
  2. * adds an image with the given matrix.
  3. * @param image image to add
  4. * @param transform transform to apply to the template prior to adding it.
  5. * @since 5.0.1
  6. * @deprecated use com.itextpdf.text.geom.AffineTransform as parameter
  7. */
  8. public void addImage(final Image image, final java.awt.geom.AffineTransform transform) throws DocumentException {
  9. double matrix[] = new double[6];
  10. transform.getMatrix(matrix);
  11. addImage(image, new AffineTransform(matrix));
  12. }

代码示例来源:origin: com.itextpdf/itextpdf

  1. /** Concatenates a transformation to the current transformation
  2. * matrix.
  3. * @param af the transformation
  4. * @deprecated use com.itextpdf.text.geom.AffineTransform as parameter
  5. */
  6. public void transform(final java.awt.geom.AffineTransform af) {
  7. double matrix[] = new double[6];
  8. af.getMatrix(matrix);
  9. transform(new AffineTransform(matrix));
  10. }
  11. }

代码示例来源:origin: com.itextpdf/itextpdf

  1. /**
  2. * Concatenate a matrix to the current transformation matrix.
  3. * @param transform added to the Current Transformation Matrix
  4. * @deprecated use com.itextpdf.text.geom.AffineTransform as parameter
  5. */
  6. public void concatCTM(final java.awt.geom.AffineTransform transform) {
  7. double matrix[] = new double[6];
  8. transform.getMatrix(matrix);
  9. concatCTM(new AffineTransform(matrix));
  10. }

代码示例来源: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: es.gob.afirma/afirma-crypto-pdf-itext

  1. /** Concatenates a transformation to the current transformation
  2. * matrix.
  3. * @param af the transformation
  4. */
  5. public void transform(AffineTransform af) {
  6. double arr[] = new double[6];
  7. af.getMatrix(arr);
  8. content.append(arr[0]).append(' ').append(arr[1]).append(' ').append(arr[2]).append(' ');
  9. content.append(arr[3]).append(' ').append(arr[4]).append(' ').append(arr[5]).append(" cm").append_i(separator);
  10. }

相关文章