/** * Gets the visibility status of the signature. * * @return the visibility status of the signature */ public boolean isInvisible() { return rect == null || rect.getWidth() == 0 || rect.getHeight() == 0; }
/** * Gets the visibility status of the signature. * * @return the visibility status of the signature */ public boolean isInvisible() { return rect == null || rect.getWidth() == 0 || rect.getHeight() == 0; }
protected void extendLastRow(CellRenderer[] lastRow, Rectangle freeBox) { if (null != lastRow && 0 != heights.size()) { heights.set(heights.size() - 1, heights.get(heights.size() - 1) + freeBox.getHeight()); occupiedArea.getBBox().moveDown(freeBox.getHeight()).increaseHeight(freeBox.getHeight()); for (CellRenderer cell : lastRow) { if (null != cell) { cell.occupiedArea.getBBox().moveDown(freeBox.getHeight()).increaseHeight(freeBox.getHeight()); } } freeBox.moveUp(freeBox.getHeight()).setHeight(0); } }
/** * Gets the maximum offset below the base line that this Text extends to. * * @return the downwards vertical offset of this {@link Text} */ @Override public float getDescent() { return -(occupiedArea.getBBox().getHeight() - yLineOffset - (float) this.getPropertyAsFloat(Property.TEXT_RISE)); }
/** * Sets the rectangle that represent the position and dimension of * the signature field in the page. * * @param pageRect The rectangle that represents the position and * dimension of the signature field in the page. */ public PdfSignatureAppearance setPageRect(Rectangle pageRect) { this.pageRect = new Rectangle(pageRect); this.rect = new Rectangle(pageRect.getWidth(), pageRect.getHeight()); return this; }
/** * Sets the rectangle that represent the position and dimension of * the signature field in the page. * * @param pageRect The rectangle that represents the position and * dimension of the signature field in the page. */ public PdfSignatureAppearance setPageRect(Rectangle pageRect) { this.pageRect = new Rectangle(pageRect); this.rect = new Rectangle(pageRect.getWidth(), pageRect.getHeight()); return this; }
private static float calculatePaddingBorderHeight(AbstractRenderer renderer) { Rectangle dummy = new Rectangle(0, 0); renderer.applyBorderBox(dummy, true); renderer.applyPaddings(dummy, true); return dummy.getHeight(); }
/** * Utility method for calculating rotated width of area in a similar way to other calculations in this class. * * @param area the initial area * @param angle the rotation angle in radians * @return width of rotated area */ public static double calculateRotatedWidth(Rectangle area, double angle) { return area.getWidth() * cos(angle) + area.getHeight() * sin(angle); }
private static float calculatePaddingBorderHeight(AbstractRenderer renderer) { Rectangle dummy = new Rectangle(0, 0); renderer.applyBorderBox(dummy, true); renderer.applyPaddings(dummy, true); return dummy.getHeight(); }
/** * Creates the copy of given {@link Rectangle} * * @param rect the copied {@link Rectangle} */ public Rectangle(Rectangle rect) { this(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight()); }
/** * Adds {@code PdfImageXObject} to specified rectangle on canvas and scale it using the rectangle's width and height. * * @param image PdfImageXObject to add * @param rect rectangle containing x and y coordinates and scaling information * @return current canvas */ private PdfCanvas addImage(PdfImageXObject image, Rectangle rect) { return addImage(image, rect.getWidth(), 0, 0, rect.getHeight(), rect.getX(), rect.getY()); }
/** * Adds {@code PdfFormXObject} to specified rectangle on canvas and scale it using the rectangle's width and height. * * @param form PdfFormXObject to add * @param rect rectangle containing x and y coordinates and scaling information * @return current canvas. */ private PdfCanvas addForm(PdfFormXObject form, Rectangle rect) { return addForm(form, rect.getWidth(), 0, 0, rect.getHeight(), rect.getX(), rect.getY()); }
/** * Draws a rectangle. * * @param rectangle a rectangle to be drawn * @return current canvas. */ public PdfCanvas rectangle(Rectangle rectangle) { return rectangle(rectangle.getX(), rectangle.getY(), rectangle.getWidth(), rectangle.getHeight()); }
/** * Creates Image XObject from image and adds it to canvas. * * @param image * @param rect * @param asInline true if to add image as in-line. * @return created XObject or null in case of in-line image (asInline = true). */ public PdfXObject addImage(ImageData image, Rectangle rect, boolean asInline) { return addImage(image, rect.getWidth(), 0, 0, rect.getHeight(), rect.getX(), rect.getY(), asInline); }
private static boolean hasPositiveHeight(IRenderer renderer) { float height = renderer.getOccupiedArea().getBBox().getHeight(); if (height == 0) { UnitValue heightPropVal = renderer.<UnitValue>getProperty(Property.HEIGHT); UnitValue minHeightPropVal = renderer.<UnitValue>getProperty(Property.MIN_HEIGHT); height = minHeightPropVal != null ? (float) minHeightPropVal.getValue() : heightPropVal != null ? (float) heightPropVal.getValue() : 0; } return height > 0; }
private void restoreLayoutBoxAfterFailedLayoutAttempt(Rectangle layoutBox) { layoutBox.setX(backupLayoutBox.getX()).setY(backupLayoutBox.getY()) .setWidth(backupLayoutBox.getWidth()).setHeight(backupLayoutBox.getHeight()); backupCollapseInfo.copyTo(collapseInfo); backupLayoutBox = null; backupCollapseInfo = null; }
AffineTransform calculateTransformation(SvgDrawContext context){ Rectangle viewPort = context.getCurrentViewPort(); float horizontal = viewPort.getX(); float vertical = viewPort.getY() + viewPort.getHeight(); // flip coordinate space vertically and translate on the y axis with the viewport height AffineTransform transform = AffineTransform.getTranslateInstance(0,0); //Identity-transform transform.concatenate(AffineTransform.getTranslateInstance(horizontal,vertical)); transform.concatenate(new AffineTransform(1,0,0,-1,0,0)); return transform; }
private void applyConcatMatrix(DrawContext drawContext, Float angle) { AffineTransform rotationTransform = AffineTransform.getRotateInstance((float) angle); Rectangle rect = getBorderAreaBBox(); List<Point> rotatedPoints = transformPoints(rectangleToPointsList(rect), rotationTransform); float[] shift = calculateShiftToPositionBBoxOfPointsAt(rect.getX(), rect.getY() + rect.getHeight(), rotatedPoints); double[] matrix = new double[6]; rotationTransform.getMatrix(matrix); drawContext.getCanvas().concatMatrix(matrix[0], matrix[1], matrix[2], matrix[3], shift[0], shift[1]); }
@Override public LayoutResult layout(LayoutContext layoutContext) { LayoutArea area = layoutContext.getArea(); Float width = retrieveWidth(area.getBBox().getWidth()); UnitValue height = this.<UnitValue>getProperty(Property.MIN_HEIGHT); occupiedArea = new LayoutArea(area.getPageNumber(), new Rectangle(area.getBBox().getX(), area.getBBox().getY() + area.getBBox().getHeight(),(float) width, (float) height.getValue())); return new LayoutResult(LayoutResult.FULL, occupiedArea, null, null); }
@Override public LayoutResult layout(LayoutContext layoutContext) { LayoutArea area = layoutContext.getArea(); Float width = retrieveWidth(area.getBBox().getWidth()); UnitValue height = this.<UnitValue>getProperty(Property.MIN_HEIGHT); occupiedArea = new LayoutArea(area.getPageNumber(), new Rectangle(area.getBBox().getX(), area.getBBox().getY() + area.getBBox().getHeight(),(float) width, (float) height.getValue())); return new LayoutResult(LayoutResult.FULL, occupiedArea, null, null); }