Class AbstractBranchSvgNodeRenderer
java.lang.Object
com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
com.itextpdf.svg.renderers.impl.AbstractBranchSvgNodeRenderer
- All Implemented Interfaces:
IBranchSvgNodeRenderer, ISvgNodeRenderer
- Direct Known Subclasses:
AbstractContainerSvgNodeRenderer, AbstractGradientSvgNodeRenderer, ClipPathSvgNodeRenderer, DefsSvgNodeRenderer, GroupSvgNodeRenderer, MarkerSvgNodeRenderer, PatternSvgNodeRenderer, StopSvgNodeRenderer
public abstract class AbstractBranchSvgNodeRenderer
extends AbstractSvgNodeRenderer
implements IBranchSvgNodeRenderer
Abstract class that will be the superclass for any element that can function
as a parent.
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractSvgNodeRenderer
AbstractSvgNodeRenderer.FillProperties, AbstractSvgNodeRenderer.StrokeProperties -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<ISvgNodeRenderer> private static final floatprivate static final org.slf4j.Loggerprotected static final intDeprecated.Fields inherited from class AbstractSvgNodeRenderer
attributesAndStyles, doFill, doStroke -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddChild(ISvgNodeRenderer child) Adds a renderer as the last element of the list of children.(package private) voidapplyViewBox(SvgDrawContext context) Applies a transformation based on a viewBox for a given branch node.private voidapplyViewportClip(SvgDrawContext context) Applies a clipping operation based on the view port.(package private) voidcalculateAndApplyViewBox(SvgDrawContext context, float[] values, Rectangle currentViewPort) private voidcleanUp(SvgDrawContext context) Cleans up the SvgDrawContext by removing the current viewport and by popping the current canvas.abstract ISvgNodeRendererCreates a deep copy of this renderer, including it's subtree of childrenprotected final voidCreate a deep copy of every child renderer and add them to the passedAbstractBranchSvgNodeRendererprotected voiddoDraw(SvgDrawContext context) Method that will set properties to be inherited by this branch renderer's children and will iterate over all children in order to draw them.private static RectangleWhen in the svg elementoverflowisvisiblethe corresponding formXObject should have a BBox (form XObject’s bounding box; see PDF 32000-1:2008 - 8.10.2 Form Dictionaries) that should cover the entire svg space (page in pdf) in order to be able to show parts of the element which are outside the current element viewPort.final List<ISvgNodeRenderer> Gets all child renderers of this object.private static booleanisOverflowVisible(AbstractSvgNodeRenderer currentElement) (package private) voidpostDraw(SvgDrawContext context) Operations to be performed after drawing the element.Methods inherited from class AbstractSvgNodeRenderer
applyFillAndStrokeProperties, applyNonScalingStrokeTransform, calculateViewPortTranslation, canConstructViewPort, canElementFill, deepCopyAttributesAndStyles, doStrokeOrFill, draw, getAttribute, getAttributeMapCopy, getAttributeOrDefault, getCurrentFontSize, getCurrentFontSize, getCurrentViewBox, getParent, getParentClipPath, isHidden, parseAbsoluteLength, parseHorizontalLength, parseVerticalLength, preDraw, retrieveAlignAndMeet, setAttribute, setAttributesAndStyles, setParentMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ISvgNodeRenderer
draw, getAttribute, getAttributeMapCopy, getObjectBoundingBox, getParent, setAttribute, setAttributesAndStyles, setParent
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
VIEWBOX_VALUES_NUMBER
Deprecated.The number of viewBox values. Deprecate in favour ofSvgConstants.Values.VIEWBOX_VALUES_NUMBER- See Also:
-
EPS
private static final float EPS- See Also:
-
children
-
-
Constructor Details
-
AbstractBranchSvgNodeRenderer
public AbstractBranchSvgNodeRenderer()
-
-
Method Details
-
doDraw
Method that will set properties to be inherited by this branch renderer's children and will iterate over all children in order to draw them.- Specified by:
doDrawin classAbstractSvgNodeRenderer- Parameters:
context- the object that knows the place to draw this element and maintains its state
-
applyViewBox
Applies a transformation based on a viewBox for a given branch node.- Parameters:
context- current svg draw context
-
applyViewportClip
Applies a clipping operation based on the view port.- Parameters:
context- the svg draw context
-
cleanUp
Cleans up the SvgDrawContext by removing the current viewport and by popping the current canvas.- Parameters:
context- context to clean
-
addChild
Description copied from interface:IBranchSvgNodeRendererAdds a renderer as the last element of the list of children.- Specified by:
addChildin interfaceIBranchSvgNodeRenderer- Parameters:
child- any renderer
-
getChildren
Description copied from interface:IBranchSvgNodeRendererGets all child renderers of this object.- Specified by:
getChildrenin interfaceIBranchSvgNodeRenderer- Returns:
- the list of child renderers (in the order that they were added)
-
deepCopyChildren
Create a deep copy of every child renderer and add them to the passedAbstractBranchSvgNodeRenderer- Parameters:
deepCopy- renderer to add copies of children to
-
postDraw
Description copied from class:AbstractSvgNodeRendererOperations to be performed after drawing the element. This includes filling, stroking.- Overrides:
postDrawin classAbstractSvgNodeRenderer- Parameters:
context- the svg draw context
-
createDeepCopy
Description copied from interface:ISvgNodeRendererCreates a deep copy of this renderer, including it's subtree of children- Specified by:
createDeepCopyin interfaceISvgNodeRenderer- Returns:
- deep copy of this renderer
-
calculateAndApplyViewBox
-
isOverflowVisible
-
getBBoxAccordingToVisibleOverflow
When in the svg elementoverflowisvisiblethe corresponding formXObject should have a BBox (form XObject’s bounding box; see PDF 32000-1:2008 - 8.10.2 Form Dictionaries) that should cover the entire svg space (page in pdf) in order to be able to show parts of the element which are outside the current element viewPort. To do this, we get the inverse matrix of all the current transformation matrix changes and apply it to the root viewPort. This allows you to get the root rectangle in the final coordinate system.- Parameters:
context- current context to get canvases and view ports- Returns:
- the set to
PdfStreambbox
-