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

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

本文整理了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

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

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

/**
 * Writes an AffineTransform to the content stream as an array.
 */
private void writeAffineTransform(AffineTransform transform) throws IOException
{
  double[] values = new double[6];
  transform.getMatrix(values);
  for (double v : values)
  {
    writeOperand((float) v);
  }
}

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

private COSStream createOverlayStream(PDPage page, LayoutPage layoutPage, COSName xObjectId)
    throws IOException
{
  // create a new content stream that executes the XObject content
  StringBuilder overlayStream = new StringBuilder();
  overlayStream.append("q\nq\n");
  AffineTransform at = calculateAffineTransform(page, layoutPage.overlayMediaBox);
  double[] flatmatrix = new double[6];
  at.getMatrix(flatmatrix);
  for (double v : flatmatrix)
  {
    overlayStream.append(float2String((float) v));
    overlayStream.append(" ");
  }
  overlayStream.append(" cm\n/");
  overlayStream.append(xObjectId.getName());
  overlayStream.append(" Do Q\nQ\n");
  return createStream(overlayStream.toString());
}

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

/**
 * Sets the optional Matrix entry for the Pattern.
 * @param transform the transformation matrix
 */
public void setMatrix(AffineTransform transform)
{
  COSArray matrix = new COSArray();
  double[] values = new double[6];
  transform.getMatrix(values);
  for (double v : values)
  {
    matrix.add(new COSFloat((float)v));
  }
  getCOSObject().setItem(COSName.MATRIX, matrix);
}

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

/**
 * Sets the optional Matrix entry for the form XObject.
 * @param transform the transformation matrix
 */
public void setMatrix(AffineTransform transform)
{
  COSArray matrix = new COSArray();
  double[] values = new double[6];
  transform.getMatrix(values);
  for (double v : values)
  {
    matrix.add(new COSFloat((float) v));
  }
  getCOSObject().setItem(COSName.MATRIX, matrix);
}

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

/**
 * Sets the optional Matrix entry for the function based shading.
 *
 * @param transform the transformation matrix
 */
public void setMatrix(AffineTransform transform)
{
  COSArray matrix = new COSArray();
  double[] values = new double[6];
  transform.getMatrix(values);
  for (double v : values)
  {
    matrix.add(new COSFloat((float) v));
  }
  getCOSObject().setItem(COSName.MATRIX, matrix);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/**
 * Writes an AffineTransform to the content stream as an array.
 */
private void writeAffineTransform(AffineTransform transform) throws IOException
{
  double[] values = new double[6];
  transform.getMatrix(values);
  for (double v : values)
  {
    writeOperand((float) v);
  }
}

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

@Override
  public boolean getValue(StyleAttribute attrib, double curTime) throws SVGException
  {
    AffineTransform retVal = new AffineTransform();
    retVal = getValue(retVal, curTime);
//        AffineTransform val = getValue(curTime);
//        if (val == null) return false;

    double[] mat = new double[6];
    retVal.getMatrix(mat);
    attrib.setStringValue("matrix(" + mat[0] + " " + mat[1] + " " + mat[2] + " " + mat[3] + " " + mat[4] + " " + mat[5] + ")");
    return true;
  }

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

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

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

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

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

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

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

private void put(AffineTransform tx) {
  if (tx == null) {
    put((byte) 0);
  } else {
    double[] m = new double[6];
    tx.getMatrix(m);
    put((byte) 1);
    put(m);
    put(tx.getType());
  }
}

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

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

相关文章