/** * 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); }
newPatternMatrix = Matrix.getScaleInstance( Math.abs(patternMatrix.getScalingFactorX()), Math.abs(patternMatrix.getScalingFactorY()));
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(); }
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(); }
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(); }
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(); }
Matrix matrix = Matrix.getScaleInstance(0.5f, 0.5f); contents.transform(matrix); contents.drawForm(form);
a.concatenate(Matrix.getScaleInstance((float)(rect.getWidth() / transformedBox.getWidth()), (float)(rect.getHeight() / transformedBox.getHeight()))); a.concatenate(Matrix.getTranslateInstance((float) -transformedBox.getX(),
/** * 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); }
Matrix scalingMatrix = Matrix.getScaleInstance(xScale, yScale); transformationMatrix.concatenate(scalingMatrix); transformed = true;
/** * 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); }
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(); }
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);
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 3, 0.001f * min / 3)); contentStream.transform(Matrix.getTranslateInstance(850, 900));
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 2.25f, 0.001f * min / 2.25f)); contentStream.transform(Matrix.getTranslateInstance(500, 375));
contentStream.transform(Matrix.getScaleInstance(0.001f * min / 1.3f, 0.001f * min / 1.3f)); contentStream.transform(Matrix.getTranslateInstance(200, 300));
contentStream.setLineWidth(200); contentStream.transform(Matrix.getScaleInstance(0.003f, 0.003f)); contentStream.transform(Matrix.getRotateInstance(Math.toRadians(45), 2500, -800));
contentStream.restoreGraphicsState(); contentStream.transform(Matrix.getScaleInstance(0.003f, 0.003f)); contentStream.transform(Matrix.getTranslateInstance(500, -300));
newPatternMatrix = Matrix.getScaleInstance( Math.abs(patternMatrix.getScalingFactorX()), Math.abs(patternMatrix.getScalingFactorY()));
a.concatenate(Matrix.getScaleInstance((float)(rect.getWidth() / transformedBox.getWidth()), (float)(rect.getHeight() / transformedBox.getHeight()))); a.concatenate(Matrix.getTranslateInstance((float) -transformedBox.getX(),