本文整理了Java中org.apache.pdfbox.util.Matrix.getScaleInstance()
方法的一些代码示例,展示了Matrix.getScaleInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.getScaleInstance()
方法的具体详情如下:
包路径:org.apache.pdfbox.util.Matrix
类名称:Matrix
方法名:getScaleInstance
[英]Convenience method to create a scaled instance.
[中]创建缩放实例的便捷方法。
代码示例来源:origin: apache/pdfbox
/**
* Scales this matrix by the given factors.
*
* @param sx x-scale
* @param sy y-scale
*/
public void scale(float sx, float sy)
{
Matrix m = Matrix.getScaleInstance(sx, sy);
concatenate(m);
}
代码示例来源:origin: apache/pdfbox
newPatternMatrix = Matrix.getScaleInstance(
Math.abs(patternMatrix.getScalingFactorX()),
Math.abs(patternMatrix.getScalingFactorY()));
代码示例来源:origin: apache/pdfbox
private void drawStar(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));
// we get the shape of a Zapf Dingbats star (0x2605) and use that one.
// Adobe uses a different font (which one?), or created the shape from scratch.
GeneralPath path = PDType1Font.ZAPF_DINGBATS.getPath("a35");
addPath(contentStream, path);
contentStream.fillAndStroke();
}
代码示例来源: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 matrix = Matrix.getScaleInstance(0.5f, 0.5f);
contents.transform(matrix);
contents.drawForm(form);
代码示例来源:origin: apache/pdfbox
a.concatenate(Matrix.getScaleInstance((float)(rect.getWidth() / transformedBox.getWidth()),
(float)(rect.getHeight() / transformedBox.getHeight())));
a.concatenate(Matrix.getTranslateInstance((float) -transformedBox.getX(),
代码示例来源:origin: com.github.lafa.pdfbox/pdfbox
/**
* Scales this matrix by the given factors.
*
* @param sx x-scale
* @param sy y-scale
*/
public void scale(float sx, float sy)
{
Matrix m = Matrix.getScaleInstance(sx, sy);
concatenate(m);
}
代码示例来源:origin: apache/pdfbox
Matrix scalingMatrix = Matrix.getScaleInstance(xScale, yScale);
transformationMatrix.concatenate(scalingMatrix);
transformed = true;
代码示例来源:origin: org.apache.pdfbox/pdfbox
/**
* Scales this matrix by the given factors.
*
* @param sx x-scale
* @param sy y-scale
*/
public void scale(float sx, float sy)
{
Matrix m = Matrix.getScaleInstance(sx, sy);
concatenate(m);
}
代码示例来源: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
initialScale = Matrix.getScaleInstance(bbox.getWidth() / bbox.getHeight(), bbox.getHeight() / bbox.getWidth());
height = bbox.getWidth();
break;
case 270:
form.setMatrix(AffineTransform.getQuadrantRotateInstance(3));
initialScale = Matrix.getScaleInstance(bbox.getWidth() / bbox.getHeight(), bbox.getHeight() / bbox.getWidth());
height = bbox.getWidth();
break;
cs.transform(Matrix.getScaleInstance(0.25f, 0.25f));
PDImageXObject img = PDImageXObject.createFromFileByExtension(imageFile, doc);
cs.drawImage(img, 0, 0);
代码示例来源:origin: apache/pdfbox
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 3, 0.001f * min / 3));
contentStream.transform(Matrix.getTranslateInstance(850, 900));
代码示例来源:origin: apache/pdfbox
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 2.25f, 0.001f * min / 2.25f));
contentStream.transform(Matrix.getTranslateInstance(500, 375));
代码示例来源:origin: apache/pdfbox
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 1.3f, 0.001f * min / 1.3f));
contentStream.transform(Matrix.getTranslateInstance(200, 300));
代码示例来源:origin: apache/pdfbox
contentStream.setLineWidth(200);
contentStream.transform(Matrix.getScaleInstance(0.003f, 0.003f));
contentStream.transform(Matrix.getRotateInstance(Math.toRadians(45), 2500, -800));
代码示例来源:origin: apache/pdfbox
contentStream.restoreGraphicsState();
contentStream.transform(Matrix.getScaleInstance(0.003f, 0.003f));
contentStream.transform(Matrix.getTranslateInstance(500, -300));
代码示例来源:origin: org.apache.pdfbox/pdfbox
newPatternMatrix = Matrix.getScaleInstance(
Math.abs(patternMatrix.getScalingFactorX()),
Math.abs(patternMatrix.getScalingFactorY()));
代码示例来源:origin: org.apache.pdfbox/pdfbox
a.concatenate(Matrix.getScaleInstance((float)(rect.getWidth() / transformedBox.getWidth()),
(float)(rect.getHeight() / transformedBox.getHeight())));
a.concatenate(Matrix.getTranslateInstance((float) -transformedBox.getX(),
内容来源于网络,如有侵权,请联系作者删除!