Class SvgImageRenderer
java.lang.Object
com.itextpdf.layout.renderer.AbstractRenderer
com.itextpdf.layout.renderer.ImageRenderer
com.itextpdf.svg.renderers.SvgImageRenderer
- All Implemented Interfaces:
IPropertyContainer, ILeafElementRenderer, IRenderer
Represents a renderer for the
SvgImage layout element.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static class -
Field Summary
Fields inherited from class ImageRenderer
deltaX, fixedXPosition, fixedYPosition, imageHeight, imageWidth, pivotYFields inherited from class AbstractRenderer
childRenderers, EPS, flushed, INF, isLastRendererForModelElement, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties -
Constructor Summary
ConstructorsConstructorDescriptionSvgImageRenderer(SvgImage image) Creates an SvgImageRenderer from its corresponding layout object. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcalculateRelativeSizedSvgSize(SvgImage svgImage, Rectangle layoutBox) voiddraw(DrawContext drawContext) Flushes the renderer subtree contents, i.e.private SvgImageRenderer.AreainitMissingMetricsAndApplyAspectRatio(Float aspectRatio, SvgImageRenderer.NullableArea retrievedArea, SvgImageRenderer.Area area, UnitValue xObjectWidth, UnitValue xObjectHeight) layout(LayoutContext layoutContext) This method simulates positioning of the renderer, including all of its children, and returns theLayoutResult, representing the layout result, including occupied area, status, i.e.private static booleantryToApplyAspectRatio(SvgImageRenderer.NullableArea retrievedArea, SvgImageRenderer.Area inputArea, SvgImageRenderer.Area resultArea, Float aspectRatio) Methods inherited from class ImageRenderer
applyPaddings, autoScale, getAscent, getBorderAreaBBox, getDescent, getImageHeight, getImageWidth, getMinMaxWidth, getNextRenderer, moveMethods inherited from class AbstractRenderer
addAllProperties, addChild, alignChildHorizontally, allowLastYLineRecursiveExtraction, applyAbsolutePosition, applyAction, applyBorderBox, applyBorderBox, applyDestination, applyDestinationsAndAnnotation, applyLinkAnnotation, applyMargins, applyMargins, applyPaddings, applyRelativePositioningTranslation, beginElementOpacityApplying, beginTransformationIfApplied, calculateAbsolutePdfBBox, calculateBBox, calculateShiftToPositionBBoxOfPointsAt, clipBackgroundArea, clipBackgroundArea, clipBorderArea, createXObject, deleteOwnProperty, deleteProperty, drawBackground, drawBorder, drawChildren, endElementOpacityApplying, endTransformationIfApplied, getBackgroundArea, getBorderRadii, getBorders, getChildRenderers, getDefaultProperty, getFirstYLineRecursively, getInnerAreaBBox, getLastYLineRecursively, getMargins, getMinMaxWidth, getModelElement, getOccupiedArea, getOccupiedAreaBBox, getOwnProperties, getOwnProperty, getPaddings, getParent, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsColor, getPropertyAsFloat, getPropertyAsFloat, getPropertyAsFont, getPropertyAsInteger, getPropertyAsTransparentColor, getPropertyAsUnitValue, hasAbsoluteUnitValue, hasOwnOrModelProperty, hasOwnProperty, hasProperty, hasRelativeUnitValue, initElementAreas, isAbsolutePosition, isBorderBoxSizing, isFirstOnRootArea, isFixedLayout, isFlushed, isKeepTogether, isNotFittingHeight, isNotFittingLayoutArea, isNotFittingWidth, isOverflowFit, isOverflowProperty, isOverflowProperty, isOverflowProperty, isPositioned, isRelativePosition, isStaticLayout, rectangleToPointsList, retrieveHeight, retrieveMaxHeight, retrieveMaxWidth, retrieveMinHeight, retrieveMinWidth, retrieveResolvedDeclaredHeight, retrieveUnitValue, retrieveUnitValue, retrieveWidth, setBorders, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, toString, transformPoints, updateHeight, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidthMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IPropertyContainer
deleteOwnProperty, getDefaultProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setPropertyMethods inherited from interface IRenderer
addChild, getChildRenderers, getModelElement, getOccupiedArea, getParent, getProperty, isFlushed, setParent
-
Constructor Details
-
SvgImageRenderer
-
-
Method Details
-
layout
Description copied from interface:IRendererThis method simulates positioning of the renderer, including all of its children, and returns theLayoutResult, representing the layout result, including occupied area, status, i.e. if there was enough place to fit the renderer subtree, etc.LayoutResultcan be extended to return custom layout results for custom elements, e.g.TextRendererusesTextLayoutResultas its result. This method can be called standalone to learn how much area the renderer subtree needs, or can be called beforeIRenderer.draw(DrawContext), to prepare the renderer to be flushed to the output stream.- Specified by:
layoutin interfaceIRenderer- Overrides:
layoutin classImageRenderer- Parameters:
layoutContext- the description of layout area and any other additional information- Returns:
- result of the layout process
-
draw
Flushes the renderer subtree contents, i.e. draws itself on canvas, adds necessary objects to thePdfDocumentetc.- Specified by:
drawin interfaceIRenderer- Overrides:
drawin classImageRenderer- Parameters:
drawContext- contains thePdfDocumentto which the renderer subtree if flushed, thePdfCanvason which the renderer subtree is drawn and other additional parameters needed to perform drawing
-
calculateRelativeSizedSvgSize
-
initMissingMetricsAndApplyAspectRatio
private SvgImageRenderer.Area initMissingMetricsAndApplyAspectRatio(Float aspectRatio, SvgImageRenderer.NullableArea retrievedArea, SvgImageRenderer.Area area, UnitValue xObjectWidth, UnitValue xObjectHeight) -
tryToApplyAspectRatio
private static boolean tryToApplyAspectRatio(SvgImageRenderer.NullableArea retrievedArea, SvgImageRenderer.Area inputArea, SvgImageRenderer.Area resultArea, Float aspectRatio)
-