Package com.itextpdf.svg.renderers.impl
Class AbstractSvgNodeRenderer
java.lang.Object
com.itextpdf.svg.renderers.impl.AbstractSvgNodeRenderer
- All Implemented Interfaces:
-
ISvgNodeRenderer
- Direct Known Subclasses:
-
AbstractBranchSvgNodeRenderer
,EllipseSvgNodeRenderer
,ImageSvgNodeRenderer
,LineSvgNodeRenderer
,PathSvgNodeRenderer
,PolylineSvgNodeRenderer
,RectangleSvgNodeRenderer
,TextLeafSvgNodeRenderer
,TextSvgBranchRenderer
,UseSvgNodeRenderer
ISvgNodeRenderer
abstract implementation.
-
Field Summary
Modifier and TypeFieldDescriptionMap that contains attributes and styles used for drawing operations. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Method to see if the renderer can create a viewportprotected boolean
Method to see if a certain renderer can use fill.protected void
deepCopyAttributesAndStyles
(ISvgNodeRenderer deepCopy) Make a deep copy of the styles and attributes of this renderer Helper method for deep copying logicprotected abstract void
doDraw
(SvgDrawContext context) Draws this element to a canvas-like object maintained in the context.final void
draw
(SvgDrawContext context) Applies transformations set to this object, if any, and delegates the drawing of this element and its children to thedoDraw
method.getAttribute
(String key) Retrieves the property value for a given key name.Get a modifiable copy of the style and attribute mapgetAttributeOrDefault
(String key, String defaultValue) Retrieves the property value for a given key name or default if the property value isnull
or missing.float
Return font-size of the current elementGets the parent of this renderer.protected float
parseAbsoluteLength
(String length, float percentBaseValue, float defaultValue, SvgDrawContext context) Parse length attributes.void
setAttribute
(String key, String value) Sets a property key and value pairs for a given attributevoid
setAttributesAndStyles
(Map<String, String> attributesAndStyles) Sets the map of XML node attributes and CSS style properties that this renderer needs.void
setParent
(ISvgNodeRenderer parent) Sets the parent of this renderer.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
createDeepCopy, getObjectBoundingBox
-
Field Details
-
attributesAndStyles
Map that contains attributes and styles used for drawing operations.
-
-
Constructor Details
-
AbstractSvgNodeRenderer
public AbstractSvgNodeRenderer()
-
-
Method Details
-
setParent
Description copied from interface:ISvgNodeRenderer
Sets the parent of this renderer. The parent may be the source of inherited properties and default values.- Specified by:
-
setParent
in interfaceISvgNodeRenderer
- Parameters:
-
parent
- the parent renderer
-
getParent
Description copied from interface:ISvgNodeRenderer
Gets the parent of this renderer. The parent may be the source of inherited properties and default values.- Specified by:
-
getParent
in interfaceISvgNodeRenderer
- Returns:
- the parent renderer; null in case of a root node
-
setAttributesAndStyles
Description copied from interface:ISvgNodeRenderer
Sets the map of XML node attributes and CSS style properties that this renderer needs.- Specified by:
-
setAttributesAndStyles
in interfaceISvgNodeRenderer
- Parameters:
-
attributesAndStyles
- the mapping from key names to values
-
getAttribute
Description copied from interface:ISvgNodeRenderer
Retrieves the property value for a given key name.- Specified by:
-
getAttribute
in interfaceISvgNodeRenderer
- Parameters:
-
key
- the name of the property to search for - Returns:
-
the value for this key, or
null
-
getAttributeOrDefault
Retrieves the property value for a given key name or default if the property value isnull
or missing.- Parameters:
-
key
- the name of the property to search for -
defaultValue
- the default value to be returned if the property isnull
or missing - Returns:
-
the value for this key, or
defaultValue
-
setAttribute
Description copied from interface:ISvgNodeRenderer
Sets a property key and value pairs for a given attribute- Specified by:
-
setAttribute
in interfaceISvgNodeRenderer
- Parameters:
-
key
- the name of the attribute -
value
- the value of the attribute
-
getAttributeMapCopy
Description copied from interface:ISvgNodeRenderer
Get a modifiable copy of the style and attribute map- Specified by:
-
getAttributeMapCopy
in interfaceISvgNodeRenderer
- Returns:
- copy of the attributes and styles-map
-
draw
Applies transformations set to this object, if any, and delegates the drawing of this element and its children to thedoDraw
method.- Specified by:
-
draw
in interfaceISvgNodeRenderer
- Parameters:
-
context
- the object that knows the place to draw this element and maintains its state
-
canElementFill
protected boolean canElementFill()Method to see if a certain renderer can use fill.- Returns:
- true if the renderer can use fill
-
canConstructViewPort
public boolean canConstructViewPort()Method to see if the renderer can create a viewport- Returns:
- true if the renderer can construct a viewport
-
getCurrentFontSize
public float getCurrentFontSize()Return font-size of the current element- Returns:
- absolute value of font-size
-
deepCopyAttributesAndStyles
Make a deep copy of the styles and attributes of this renderer Helper method for deep copying logic- Parameters:
-
deepCopy
- renderer to insert the deep copied attributes into
-
doDraw
Draws this element to a canvas-like object maintained in the context.- Parameters:
-
context
- the object that knows the place to draw this element and maintains its state
-
parseAbsoluteLength
protected float parseAbsoluteLength(String length, float percentBaseValue, float defaultValue, SvgDrawContext context) Parse length attributes.- Parameters:
-
length
-String
for parsing -
percentBaseValue
- the value on which percent length is based on -
defaultValue
- default value if length is not recognized -
context
- currentSvgDrawContext
- Returns:
- absolute value in points
-