本文整理了Java中org.apache.pdfbox.util.Matrix.getTranslateInstance()
方法的一些代码示例,展示了Matrix.getTranslateInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.getTranslateInstance()
方法的具体详情如下:
包路径:org.apache.pdfbox.util.Matrix
类名称:Matrix
方法名:getTranslateInstance
[英]Convenience method to create a translating instance.
[中]创建翻译实例的便捷方法。
代码示例来源:origin: apache/pdfbox
/**
* Convenience method to create a translating instance.
*
* @param tx The x translating operator.
* @param ty The y translating operator.
* @return A new matrix with just the x/y translating.
* @deprecated Use {@link #getTranslateInstance} instead.
*/
@Deprecated
public static Matrix getTranslatingInstance(float tx, float ty)
{
return getTranslateInstance(tx, ty);
}
代码示例来源:origin: apache/pdfbox
/**
* Applies a text position adjustment from the TJ operator. May be overridden in subclasses.
*
* @param tx x-translation
* @param ty y-translation
*/
protected void applyTextAdjustment(float tx, float ty) throws IOException
{
// update the text matrix
textMatrix.concatenate(Matrix.getTranslateInstance(tx, ty));
}
代码示例来源:origin: apache/pdfbox
/**
* Translates this matrix by the given ammount.
*
* @param tx x-translation
* @param ty y-translation
*/
public void translate(float tx, float ty)
{
Matrix m = Matrix.getTranslateInstance(tx, ty);
concatenate(m);
}
代码示例来源:origin: apache/pdfbox
/**
* The Tm operator. Sets the text matrix to the given translation values.
* A current text matrix will be replaced with the new one.
* @param tx The translation value in x-direction.
* @param ty The translation value in y-direction.
* @throws IOException If there is an error writing to the stream.
* @deprecated Use {@link #setTextMatrix(Matrix)} instead.
*/
@Deprecated
public void setTextTranslation(double tx, double ty) throws IOException
{
setTextMatrix(Matrix.getTranslateInstance((float) tx, (float) ty));
}
代码示例来源:origin: apache/pdfbox
/**
* Translates this matrix by the given vector.
*
* @param vector 2D vector
*/
public void translate(Vector vector)
{
Matrix m = Matrix.getTranslateInstance(vector.getX(), vector.getY());
concatenate(m);
}
代码示例来源:origin: apache/pdfbox
GeneralPath p = r.transform(Matrix.getTranslateInstance(-cropBox.getLowerLeftX(), cropBox.getLowerLeftY()));
Shape s = flip.createTransformedShape(p);
graphics.setColor(Color.green);
代码示例来源:origin: apache/pdfbox
Matrix.getTranslateInstance(-pattern.getBBox().getLowerLeftX(),
-pattern.getBBox().getLowerLeftY()));
代码示例来源:origin: apache/pdfbox
/**
* This will initialize and process the contents of the stream.
*
* @param page the page to process
* @throws java.io.IOException if there is an error accessing the stream.
*/
@Override
public void processPage(PDPage page) throws IOException
{
this.pageRotation = page.getRotation();
this.pageSize = page.getCropBox();
if (Float.compare(pageSize.getLowerLeftX(), 0) == 0 && Float.compare(pageSize.getLowerLeftY(), 0) == 0)
{
translateMatrix = null;
}
else
{
// translation matrix for cropbox
translateMatrix = Matrix.getTranslateInstance(-pageSize.getLowerLeftX(), -pageSize.getLowerLeftY());
}
super.processPage(page);
}
代码示例来源:origin: apache/pdfbox
private void drawCheck(PDAnnotationText annotation, final PDAppearanceContentStream contentStream)
throws IOException
{
PDRectangle bbox = adjustRectAndBBox(annotation, 20, 19);
float min = Math.min(bbox.getWidth(), bbox.getHeight());
contentStream.setMiterLimit(4);
contentStream.setLineJoinStyle(1);
contentStream.setLineCapStyle(0);
contentStream.setLineWidth(0.59f); // value from Adobe
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 0.8f, 0.001f * min / 0.8f));
contentStream.transform(Matrix.getTranslateInstance(0, 50));
// we get the shape of a Zapf Dingbats check (0x2714) and use that one.
// Adobe uses a different font (which one?), or created the shape from scratch.
GeneralPath path = PDType1Font.ZAPF_DINGBATS.getPath("a20");
addPath(contentStream, path);
contentStream.fillAndStroke();
}
代码示例来源:origin: apache/pdfbox
private void drawRightPointer(PDAnnotationText annotation, final PDAppearanceContentStream contentStream)
throws IOException
{
PDRectangle bbox = adjustRectAndBBox(annotation, 20, 17);
float min = Math.min(bbox.getWidth(), bbox.getHeight());
contentStream.setMiterLimit(4);
contentStream.setLineJoinStyle(1);
contentStream.setLineCapStyle(0);
contentStream.setLineWidth(0.59f); // value from Adobe
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 0.8f, 0.001f * min / 0.8f));
contentStream.transform(Matrix.getTranslateInstance(0, 50));
// we get the shape of a Zapf Dingbats right pointer (0x27A4) and use that one.
// Adobe uses a different font (which one?), or created the shape from scratch.
GeneralPath path = PDType1Font.ZAPF_DINGBATS.getPath("a174");
addPath(contentStream, path);
contentStream.fillAndStroke();
}
代码示例来源:origin: apache/pdfbox
private void drawCrossHairs(PDAnnotationText annotation, final PDAppearanceContentStream contentStream)
throws IOException
{
PDRectangle bbox = adjustRectAndBBox(annotation, 20, 20);
float min = Math.min(bbox.getWidth(), bbox.getHeight());
contentStream.setMiterLimit(4);
contentStream.setLineJoinStyle(0);
contentStream.setLineCapStyle(0);
contentStream.setLineWidth(0.61f); // value from Adobe
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 1.5f, 0.001f * min / 1.5f));
contentStream.transform(Matrix.getTranslateInstance(0, 50));
// we get the shape of a Symbol crosshair (0x2295) and use that one.
// Adobe uses a different font (which one?), or created the shape from scratch.
GeneralPath path = PDType1Font.SYMBOL.getPath("circleplus");
addPath(contentStream, path);
contentStream.fillAndStroke();
}
代码示例来源:origin: apache/pdfbox
Matrix a = Matrix.getTranslateInstance(rect.getLowerLeftX(), rect.getLowerLeftY());
a.concatenate(Matrix.getScaleInstance((float)(rect.getWidth() / transformedBox.getWidth()),
(float)(rect.getHeight() / transformedBox.getHeight())));
a.concatenate(Matrix.getTranslateInstance((float) -transformedBox.getX(),
(float) -transformedBox.getY()));
代码示例来源:origin: apache/pdfbox
private void drawNewParagraph(PDAnnotationText annotation, final PDAppearanceContentStream contentStream)
throws IOException
{
adjustRectAndBBox(annotation, 13, 20);
contentStream.setMiterLimit(4);
contentStream.setLineJoinStyle(0);
contentStream.setLineCapStyle(0);
contentStream.setLineWidth(0.59f); // value from Adobe
// small triangle (values from Adobe)
contentStream.moveTo(6.4995f, 20);
contentStream.lineTo(0.295f, 7.287f);
contentStream.lineTo(12.705f, 7.287f);
contentStream.closeAndFillAndStroke();
// rescale and translate so that "NP" fits below the triangle
// values gathered by trial and error
contentStream.transform(Matrix.getScaleInstance(0.001f * 4, 0.001f * 4));
contentStream.transform(Matrix.getTranslateInstance(200, 0));
addPath(contentStream, PDType1Font.HELVETICA_BOLD.getPath("N"));
contentStream.transform(Matrix.getTranslateInstance(1300, 0));
addPath(contentStream, PDType1Font.HELVETICA_BOLD.getPath("P"));
contentStream.fill();
}
代码示例来源:origin: apache/pdfbox
textMatrix.concatenate(Matrix.getTranslateInstance(tx, ty));
代码示例来源:origin: apache/pdfbox
cs.transform(Matrix.getTranslateInstance(-fontBBox.getLowerLeftX(), -fontBBox.getLowerLeftY()));
try
代码示例来源:origin: apache/pdfbox
contentStream.setTextMatrix(Matrix.getTranslateInstance(centerX, centerY));
代码示例来源:origin: apache/pdfbox
contentStream.transform(Matrix.getTranslateInstance(500, 375));
代码示例来源:origin: apache/pdfbox
contentStream.transform(Matrix.getTranslateInstance(200, 300));
代码示例来源:origin: apache/pdfbox
contentStream.transform(Matrix.getTranslateInstance(850, 900));
代码示例来源:origin: apache/pdfbox
contentStream.transform(Matrix.getTranslateInstance(500, -300));
内容来源于网络,如有侵权,请联系作者删除!