org.apache.pdfbox.util.Matrix.transformPoint()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(168)

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

Matrix.transformPoint介绍

[英]Transforms the given point by this matrix.
[中]通过这个矩阵变换给定的点。

代码示例

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

/**
 * Returns a path which represents this rectangle having been transformed by the given matrix.
 * Note that the resulting path need not be rectangular.
 */
public GeneralPath transform(Matrix matrix)
{
  float x1 = getLowerLeftX();
  float y1 = getLowerLeftY();
  float x2 = getUpperRightX();
  float y2 = getUpperRightY();
  Point2D.Float p0 = matrix.transformPoint(x1, y1);
  Point2D.Float p1 = matrix.transformPoint(x2, y1);
  Point2D.Float p2 = matrix.transformPoint(x2, y2);
  Point2D.Float p3 = matrix.transformPoint(x1, y2);
  GeneralPath path = new GeneralPath();
  path.moveTo(p0.getX(), p0.getY());
  path.lineTo(p1.getX(), p1.getY());
  path.lineTo(p2.getX(), p2.getY());
  path.lineTo(p3.getX(), p3.getY());
  path.closePath();
  return path;
}

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

float dstY = interpolate(y, maxSrcCoord, rangeY.getMin(), rangeY.getMax());
LOG.debug("coord: " + String.format("[%06X,%06X] -> [%f,%f]", x, y, dstX, dstY));
Point2D p = matrix.transformPoint(dstX, dstY);
xform.transform(p, p);

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

float px = interpolate(x, maxSrcCoord, rangeX.getMin(), rangeX.getMax());
float py = interpolate(y, maxSrcCoord, rangeY.getMin(), rangeY.getMax());
Point2D p = matrix.transformPoint(px, py);
xform.transform(p, p);
points[i] = p;

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

if (font instanceof PDType3Font)
  height = font.getFontMatrix().transformPoint(0, glyphHeight).y;

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

Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), rect.getHeight());

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

bbox = new PDRectangle(-rd, -rd, rect.getWidth() + 2 * rd, rect.getHeight() + 2 * rd);
Matrix matrix = annotation.getNormalAppearanceStream().getMatrix();
matrix.transformPoint(rd, rd);
annotation.getNormalAppearanceStream().setMatrix(matrix.createAffineTransform());
PDRectangle rect2 = new PDRectangle(rect.getLowerLeftX() - rd, rect.getLowerLeftY() - rd,

代码示例来源:origin: com.github.lafa.pdfbox/pdfbox

/**
 * Returns a path which represents this rectangle having been transformed by the given matrix.
 * Note that the resulting path need not be rectangular.
 */
public GeneralPath transform(Matrix matrix)
{
  float x1 = getLowerLeftX();
  float y1 = getLowerLeftY();
  float x2 = getUpperRightX();
  float y2 = getUpperRightY();
  Point2D.Float p0 = matrix.transformPoint(x1, y1);
  Point2D.Float p1 = matrix.transformPoint(x2, y1);
  Point2D.Float p2 = matrix.transformPoint(x2, y2);
  Point2D.Float p3 = matrix.transformPoint(x1, y2);
  GeneralPath path = new GeneralPath();
  path.moveTo(p0.getX(), p0.getY());
  path.lineTo(p1.getX(), p1.getY());
  path.lineTo(p2.getX(), p2.getY());
  path.lineTo(p3.getX(), p3.getY());
  path.closePath();
  return path;
}

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

/**
 * Returns a path which represents this rectangle having been transformed by the given matrix. Note that the
 * resulting path need not be rectangular.
 * 
 * @param matrix the matrix to be used for the transformation.
 * 
 * @return the resulting path.
 */
public GeneralPath transform(Matrix matrix)
{
  float x1 = getLowerLeftX();
  float y1 = getLowerLeftY();
  float x2 = getUpperRightX();
  float y2 = getUpperRightY();
  Point2D.Float p0 = matrix.transformPoint(x1, y1);
  Point2D.Float p1 = matrix.transformPoint(x2, y1);
  Point2D.Float p2 = matrix.transformPoint(x2, y2);
  Point2D.Float p3 = matrix.transformPoint(x1, y2);
  GeneralPath path = new GeneralPath();
  path.moveTo(p0.getX(), p0.getY());
  path.lineTo(p1.getX(), p1.getY());
  path.lineTo(p2.getX(), p2.getY());
  path.lineTo(p3.getX(), p3.getY());
  path.closePath();
  return path;
}

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

float dstY = interpolate(y, maxSrcCoord, rangeY.getMin(), rangeY.getMax());
LOG.debug("coord: " + String.format("[%06X,%06X] -> [%f,%f]", x, y, dstX, dstY));
Point2D p = matrix.transformPoint(dstX, dstY);
xform.transform(p, p);

代码示例来源:origin: stackoverflow.com

PDDocument document = PDDocument.load(resource);
PDPage page = document.getDocumentCatalog().getPages().get(0);
PDPageContentStream cs = new PDPageContentStream(document, page, PDPageContentStream.AppendMode.PREPEND, false, false);
Matrix matrix = Matrix.getRotateInstance(Math.toRadians(45), 0, 0);
cs.transform(matrix);
cs.close();

PDRectangle cropBox = page.getCropBox();
float cx = (cropBox.getLowerLeftX() + cropBox.getUpperRightX()) / 2;
float cy = (cropBox.getLowerLeftY() + cropBox.getUpperRightY()) / 2;
Point2D.Float newC = matrix.transformPoint(cx, cy);
float tx = (float)newC.getX() - cx;
float ty = (float)newC.getY() - cy;
page.setCropBox(new PDRectangle(cropBox.getLowerLeftX() + tx, cropBox.getLowerLeftY() + ty, cropBox.getWidth(), cropBox.getHeight()));
PDRectangle mediaBox = page.getMediaBox();
page.setMediaBox(new PDRectangle(mediaBox.getLowerLeftX() + tx, mediaBox.getLowerLeftY() + ty, mediaBox.getWidth(), mediaBox.getHeight()));

代码示例来源:origin: com.github.lafa.pdfbox/pdfbox

float dstY = interpolate(y, maxSrcCoord, rangeY.getMin(), rangeY.getMax());
LOG.debug("coord: " + String.format("[%06X,%06X] -> [%f,%f]", x, y, dstX, dstY));
Point2D p = matrix.transformPoint(dstX, dstY);
xform.transform(p, p);

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

float px = interpolate(x, maxSrcCoord, rangeX.getMin(), rangeX.getMax());
float py = interpolate(y, maxSrcCoord, rangeY.getMin(), rangeY.getMax());
Point2D p = matrix.transformPoint(px, py);
xform.transform(p, p);
points[i] = p;

代码示例来源:origin: com.github.lafa.pdfbox/pdfbox

float px = interpolate(x, maxSrcCoord, rangeX.getMin(), rangeX.getMax());
float py = interpolate(y, maxSrcCoord, rangeY.getMin(), rangeY.getMax());
Point2D p = matrix.transformPoint(px, py);
xform.transform(p, p);
points[i] = p;

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

Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), rect.getHeight());

代码示例来源:origin: com.github.lafa.pdfbox/pdfbox

Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), rect.getHeight());

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

if (font instanceof PDType3Font)
  height = font.getFontMatrix().transformPoint(0, glyphHeight).y;

代码示例来源:origin: com.github.lafa.pdfbox/pdfbox

if (font instanceof PDType3Font)
  height = font.getFontMatrix().transformPoint(0, glyphHeight).y;

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.io.pdf-asl

if (font instanceof PDType3Font)
  height = font.getFontMatrix().transformPoint(0, glyphHeight).y;

相关文章