Package com.itextpdf.svg.renderers.impl
Class MarkerSvgNodeRenderer
- java.lang.Object
-
- com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
-
- com.itextpdf.svg.renderers.impl.AbstractBranchSvgNodeRenderer
-
- com.itextpdf.svg.renderers.impl.MarkerSvgNodeRenderer
-
- All Implemented Interfaces:
IBranchSvgNodeRenderer
,ISvgNodeRenderer
public class MarkerSvgNodeRenderer extends AbstractBranchSvgNodeRenderer
ISvgNodeRenderer
implementation for the <marker> tag.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
AbstractSvgNodeRenderer.FillProperties, AbstractSvgNodeRenderer.StrokeProperties
-
-
Field Summary
Fields Modifier and Type Field Description private static float
DEFAULT_MARKER_HEIGHT
private static float
DEFAULT_MARKER_WIDTH
private static float
DEFAULT_REF_X
private static float
DEFAULT_REF_Y
static java.lang.String
MARKER_INDEX
Attribute defining the marker index on polygon, line or polyline.-
Fields inherited from class com.itextpdf.svg.renderers.impl.AbstractBranchSvgNodeRenderer
VIEWBOX_VALUES_NUMBER
-
Fields inherited from class com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
attributesAndStyles, doFill, doStroke
-
-
Constructor Summary
Constructors Constructor Description MarkerSvgNodeRenderer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
applyCoordinatesTranslation(SvgDrawContext context)
(package private) void
applyMarkerAttributes(SvgDrawContext context)
private void
applyRotation(SvgDrawContext context)
private void
applyUserSpaceScaling(SvgDrawContext context)
protected void
applyViewBox(SvgDrawContext context)
Applies a transformation based on a viewBox for a given branch node.ISvgNodeRenderer
createDeepCopy()
Creates a deep copy of this renderer, including it's subtree of children(package private) static void
drawMarker(SvgDrawContext context, java.lang.String moveX, java.lang.String moveY, MarkerVertexType markerToUse, AbstractSvgNodeRenderer parent)
(package private) static void
drawMarkers(SvgDrawContext context, int startIndex, java.util.List<Point> markerPoints, MarkerVertexType markerToUse, AbstractSvgNodeRenderer parent)
private float[]
getMarkerWidthHeightValues()
Rectangle
getObjectBoundingBox(SvgDrawContext context)
Calculates the current object bounding box.private float[]
getViewBoxValues(float defaultWidth, float defaultHeight)
protected boolean
isHidden()
Check if this renderer should draw the element based on its attributes (e.g.private static boolean
markerWidthHeightAreCorrect(MarkerSvgNodeRenderer namedObject)
(package private) void
preDraw(SvgDrawContext context)
Operations to perform before drawing an element.-
Methods inherited from class com.itextpdf.svg.renderers.impl.AbstractBranchSvgNodeRenderer
addChild, calculateAndApplyViewBox, deepCopyChildren, doDraw, getChildren, postDraw
-
Methods inherited from class com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
applyFillAndStrokeProperties, applyNonScalingStrokeTransform, calculateViewPortTranslation, canConstructViewPort, canElementFill, deepCopyAttributesAndStyles, doStrokeOrFill, draw, getAttribute, getAttributeMapCopy, getAttributeOrDefault, getCurrentFontSize, getCurrentFontSize, getCurrentViewBox, getParent, getParentClipPath, parseAbsoluteLength, parseHorizontalLength, parseVerticalLength, retrieveAlignAndMeet, setAttribute, setAttributesAndStyles, setParent
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.itextpdf.svg.renderers.ISvgNodeRenderer
draw, getAttribute, getAttributeMapCopy, getParent, setAttribute, setAttributesAndStyles, setParent
-
-
-
-
Field Detail
-
MARKER_INDEX
public static final java.lang.String MARKER_INDEX
Attribute defining the marker index on polygon, line or polyline. It is not a property from css standard, used for internal marker processing.- See Also:
- Constant Field Values
-
DEFAULT_MARKER_WIDTH
private static final float DEFAULT_MARKER_WIDTH
- See Also:
- Constant Field Values
-
DEFAULT_MARKER_HEIGHT
private static final float DEFAULT_MARKER_HEIGHT
- See Also:
- Constant Field Values
-
DEFAULT_REF_X
private static final float DEFAULT_REF_X
- See Also:
- Constant Field Values
-
DEFAULT_REF_Y
private static final float DEFAULT_REF_Y
- See Also:
- Constant Field Values
-
-
Method Detail
-
createDeepCopy
public ISvgNodeRenderer createDeepCopy()
Description copied from interface:ISvgNodeRenderer
Creates a deep copy of this renderer, including it's subtree of children- Specified by:
createDeepCopy
in interfaceISvgNodeRenderer
- Specified by:
createDeepCopy
in classAbstractBranchSvgNodeRenderer
- Returns:
- deep copy of this renderer
-
getObjectBoundingBox
public Rectangle getObjectBoundingBox(SvgDrawContext context)
Description copied from interface:ISvgNodeRenderer
Calculates the current object bounding box.- Parameters:
context
- the current context, for instance it contains current viewport and available font data- Returns:
- the
Rectangle
representing the current object's bounding box, or null if bounding box is undefined
-
isHidden
protected boolean isHidden()
Description copied from class:AbstractSvgNodeRenderer
Check if this renderer should draw the element based on its attributes (e.g. visibility/display)- Overrides:
isHidden
in classAbstractSvgNodeRenderer
- Returns:
- true if element won't be drawn, false otherwise
-
preDraw
void preDraw(SvgDrawContext context)
Description copied from class:AbstractSvgNodeRenderer
Operations to perform before drawing an element. This includes setting stroke color and width, fill color.- Overrides:
preDraw
in classAbstractSvgNodeRenderer
- Parameters:
context
- the svg draw context
-
applyMarkerAttributes
void applyMarkerAttributes(SvgDrawContext context)
-
drawMarker
static void drawMarker(SvgDrawContext context, java.lang.String moveX, java.lang.String moveY, MarkerVertexType markerToUse, AbstractSvgNodeRenderer parent)
-
drawMarkers
static void drawMarkers(SvgDrawContext context, int startIndex, java.util.List<Point> markerPoints, MarkerVertexType markerToUse, AbstractSvgNodeRenderer parent)
-
applyViewBox
protected void applyViewBox(SvgDrawContext context)
Description copied from class:AbstractBranchSvgNodeRenderer
Applies a transformation based on a viewBox for a given branch node.- Overrides:
applyViewBox
in classAbstractBranchSvgNodeRenderer
- Parameters:
context
- current svg draw context
-
getMarkerWidthHeightValues
private float[] getMarkerWidthHeightValues()
-
markerWidthHeightAreCorrect
private static boolean markerWidthHeightAreCorrect(MarkerSvgNodeRenderer namedObject)
-
applyRotation
private void applyRotation(SvgDrawContext context)
-
applyUserSpaceScaling
private void applyUserSpaceScaling(SvgDrawContext context)
-
applyCoordinatesTranslation
private void applyCoordinatesTranslation(SvgDrawContext context)
-
getViewBoxValues
private float[] getViewBoxValues(float defaultWidth, float defaultHeight)
-
-