public abstract class AbstractSvgNodeRenderer extends Object implements ISvgNodeRenderer
ISvgNodeRenderer
abstract implementation.
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
attributesAndStyles
Map that contains attributes and styles used for drawing operations
|
Constructor and Description |
---|
AbstractSvgNodeRenderer() |
Modifier and Type | Method and Description |
---|---|
boolean |
canConstructViewPort()
Method to see if the renderer can create a viewport
|
protected boolean |
canElementFill()
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 logic
|
protected abstract void |
doDraw(SvgDrawContext context)
Draws this element to a canvas-like object maintained in the context.
|
void |
draw(SvgDrawContext context)
Applies transformations set to this object, if any, and delegates the drawing of this element and its children to the doDraw method.
|
String |
getAttribute(String key)
Retrieves the property value for a given key name.
|
Map<String,String> |
getAttributeMapCopy()
Get a modifiable copy of the style and attribute map
|
String |
getAttributeOrDefault(String key, String defaultValue)
Retrieves the property value for a given key name or default if the property value is null or missing.
|
float |
getCurrentFontSize()
Return font-size of the current element
|
protected Rectangle |
getObjectBoundingBox(SvgDrawContext context)
Deprecated.
|
ISvgNodeRenderer |
getParent()
Gets the parent of this renderer.
|
protected float |
parseAbsoluteLength(String length, float percentRelativeValue, float defaultValue, SvgDrawContext context)
Parse absolute length.
|
void |
setAttribute(String key, String value)
Sets a property key and value pairs for a given attribute
|
void |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createDeepCopy
public void setParent(ISvgNodeRenderer parent)
ISvgNodeRenderer
setParent
in interface ISvgNodeRenderer
parent
- the parent renderer
public ISvgNodeRenderer getParent()
ISvgNodeRenderer
getParent
in interface ISvgNodeRenderer
public void setAttributesAndStyles(Map<String,String> attributesAndStyles)
ISvgNodeRenderer
setAttributesAndStyles
in interface ISvgNodeRenderer
attributesAndStyles
- the mapping from key names to values
public String getAttribute(String key)
ISvgNodeRenderer
getAttribute
in interface ISvgNodeRenderer
key
- the name of the property to search for
null
public String getAttributeOrDefault(String key, String defaultValue)
null
or missing.
key
- the name of the property to search for
defaultValue
- the default value to be returned if the property is null
or missing
defaultValue
public void setAttribute(String key, String value)
ISvgNodeRenderer
setAttribute
in interface ISvgNodeRenderer
key
- the name of the attribute
value
- the value of the attribute
public Map<String,String> getAttributeMapCopy()
ISvgNodeRenderer
getAttributeMapCopy
in interface ISvgNodeRenderer
public final void draw(SvgDrawContext context)
doDraw
method.
draw
in interface ISvgNodeRenderer
context
- the object that knows the place to draw this element and maintains its state
protected boolean canElementFill()
public boolean canConstructViewPort()
public float getCurrentFontSize()
protected void deepCopyAttributesAndStyles(ISvgNodeRenderer deepCopy)
deepCopy
- renderer to insert the deep copied attributes into
protected abstract void doDraw(SvgDrawContext context)
context
- the object that knows the place to draw this element and maintains its state
@Deprecated protected Rectangle getObjectBoundingBox(SvgDrawContext context)
Rectangle
representing the current object's bounding box
protected float parseAbsoluteLength(String length, float percentRelativeValue, float defaultValue, SvgDrawContext context)
length
- String
for parsing
percentRelativeValue
- the value on which percent length is based on
defaultValue
- default value if length is not recognized
context
- current SvgDrawContext
Copyright © 1998–2020 iText Group NV. All rights reserved.