itext.svg
This is the main container class for static methods that do high-level
conversion operations from input to PDF, either by drawing on a canvas or by
returning an XObject, which can then be used by the calling class for further
processing and drawing operations.
Draws a String containing valid SVG to a document, on a given page
number at the origin of the page.
the String value containing valid SVG content
the
instance to draw on
the page to draw on
Draws a String containing valid SVG to a document, on a given page
number on the provided x and y coordinate.
the String value containing valid SVG content
the
instance to draw on
the page to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
Draws a String containing valid SVG to a document, on a given page
number on the provided x and y coordinate.
the Stream object containing valid SVG content
the
instance to draw on
the page to draw on
a container for extra properties that customize the behavior
Draws a String containing valid SVG to a document, on a given page
number on the provided x and y coordinate.
the Stream object containing valid SVG content
the
instance to draw on
the page to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
a container for extra properties that customize the behavior
Draws a Stream containing valid SVG to a document, on a given page
number ate the origni of the page.
the Stream object containing valid SVG content
the
instance to draw on
the page to draw on
Draws a Stream containing valid SVG to a document, on a given page
number on the provided x and y coordinate.
the Stream object containing valid SVG content
the
instance to draw on
the page to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
Draws a Stream containing valid SVG to a document, on a given page
number on the provided x and y coordinate.
the Stream object containing valid SVG content
the
instance to draw on
the page to draw on
a container for extra properties that customize the behavior
Draws a Stream containing valid SVG to a document, on a given page
number on the provided x and y coordinate.
the Stream object containing valid SVG content
the
instance to draw on
the page to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
a container for extra properties that customize the behavior
Draws a String containing valid SVG to a given page at the origin of the page.
the String value containing valid SVG content
the
instance to draw on
Draws a String containing valid SVG to a given page on the provided x and y coordinate.
the String value containing valid SVG content
the
instance to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
Draws a String containing valid SVG to a given page on the provided x and y coordinate.
the String value containing valid SVG content
the
instance to draw on
a container for extra properties that customize the behavior
Draws a String containing valid SVG to a given page on the provided x and y coordinate.
the String value containing valid SVG content
the
instance to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
a container for extra properties that customize the behavior
Draws a Stream containing valid SVG to a given page at coordinate 0,0.
the
Stream
object containing valid SVG content
the
instance to draw on
Draws a Stream containing valid SVG to a given page, at a given location.
the
Stream
object containing valid SVG content
the
instance to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
Draws a Stream containing valid SVG to a given page at a given location.
the
Stream
object containing valid SVG content
the
instance to draw on
a container for extra properties that customize the behavior
Draws a Stream containing valid SVG to a given page at a given location.
the
Stream
object containing valid SVG content
the
instance to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
a container for extra properties that customize the behavior
Draws a String containing valid SVG to a pre-made canvas object.
the String value containing valid SVG content
the
instance to draw on
Draws a String containing valid SVG to a pre-made canvas object.
the String value containing valid SVG content
the
instance to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
Draws a String containing valid SVG to a pre-made canvas object.
the String value containing valid SVG content
the
instance to draw on
a container for extra properties that customize the behavior
draws a String containing valid SVG to a pre-made canvas object, at a specified location.
the String value containing valid SVG content
the
instance to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
a container for extra properties that customize the behavior
Draws a Stream containing valid SVG to a pre-made canvas object.
the
Stream
object containing valid SVG content
the
instance to draw on
Draws a Stream containing valid SVG to a pre-made canvas object, to a specified location.
the
Stream
object containing valid SVG content
the
instance to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
Draws a Stream containing valid SVG to a pre-made canvas object.
the
Stream
object containing valid SVG content
the
instance to draw on
a container for extra properties that customize the behavior
Draws a String containing valid SVG to a pre-made canvas object, at a specified position on the canvas.
the
Stream
object containing valid SVG content
the
instance to draw on
x-coordinate of the location to draw at
y-coordinate of the location to draw at
a container for extra properties that customize the behavior
Converts SVG stored in a
to a PDF
.
the
containing the source SVG
the
containing the resulting PDF
Converts SVG stored in a
to a PDF
,
using specific
.
the
containing the source SVG
the
containing the resulting PDF
a
instance
Converts SVG stored in a
to a PDF
,
using
the
containing the source SVG
the
containing the resulting PDF
the
for the pdf document
Converts SVG stored in a
to a PDF
,
using specific
and
.
the
containing the source SVG
the
containing the resulting PDF
a
instance
a
for the pdf document
Copies properties from custom ISvgConverterProperties into new SvgConverterProperties.
Copies properties from custom ISvgConverterProperties into new SvgConverterProperties.
Since ISvgConverterProperties itself is immutable we have to do it.
Create a single page pdf containing the SVG on its page using the default processing and drawing logic
Stream
containing the SVG
PDF destination outputStream
Create a single page pdf containing the SVG on its page using the default processing and drawing logic
Stream
containing the SVG
PDF destination outputStream
writerproperties for the pdf document
Create a single page pdf containing the SVG on its page using the default processing and drawing logic
Stream
containing the SVG
PDF destination outputStream
Svg
to change default behaviour
Create a single page pdf containing the SVG on its page using the default processing and drawing logic
Stream
containing the SVG
to change default behaviour
PDF destination outputStream
for the pdf document
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
.
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
. This method does NOT manipulate the
in any way.
This method (or its overloads) is the best method to use if you want to
reuse the same SVG image multiple times on the same
.
If you want to reuse this object on other
instances,
please either use any of the
overloads in this same
class and convert its result to an XObject with
, or look into
using
.
the String value containing valid SVG content
the
instance to draw on
a
XObject
containing the PDF instructions
corresponding to the passed SVG content
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
.
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
. This method does NOT manipulate the
in any way.
This method (or its overloads) is the best method to use if you want to
reuse the same SVG image multiple times on the same
.
If you want to reuse this object on other
instances,
please either use any of the
overloads in this same
class and convert its result to an XObject with
, or look into
using
.
the String value containing valid SVG content
the
instance to draw on
to customize the behavior
a
XObject
containing the PDF instructions
corresponding to the passed SVG content
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
.
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
. This method does NOT manipulate the
in any way.
This method (or its overloads) is the best method to use if you want to
reuse the same SVG image multiple times on the same
.
If you want to reuse this object on other
instances,
please either use any of the
overloads in this same
class and convert its result to an XObject with
, or look into
using
.
the
Stream
object containing valid SVG content
the
instance to draw on
to customize the behavior
a
XObject
containing the PDF instructions
corresponding to the passed SVG content
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
.
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
. This method does NOT manipulate the
in any way.
This method (or its overloads) is the best method to use if you want to
reuse the same SVG image multiple times on the same
.
If you want to reuse this object on other
instances,
please either use any of the
overloads in this same
class and convert its result to an XObject with
, or look into
using
.
the
Stream
object containing valid SVG content
the
instance to draw on
a
XObject
containing the PDF instructions
corresponding to the passed SVG content
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
.
Converts a String containing valid SVG content to an
XObject
that can then be used on the passed
. This method does NOT manipulate the
in any way.
This method (or its overloads) is the best method to use if you want to
reuse the same SVG image multiple times on the same
.
If you want to reuse this object on other
instances,
please either use any of the
overloads in this same
class and convert its result to an XObject with
, or look into
using
.
the Stream object containing valid SVG content
the
instance to draw on
a
Image
containing the PDF instructions
corresponding to the passed SVG content
Converts a String containing valid SVG content to an
image
that can then be used on the passed
.
Converts a String containing valid SVG content to an
image
that can then be used on the passed
. This method does NOT manipulate the
in any way.
This method (or its overloads) is the best method to use if you want to
reuse the same SVG image multiple times on the same
.
If you want to reuse this object on other
instances,
please either use any of the
overloads in this same
class and convert its result to an XObject with
, or look into
using
.
the
Stream
object containing valid SVG content
the
instance to draw on
to customize the behavior
a
Image
containing the PDF instructions
corresponding to the passed SVG content
This method draws a NodeRenderer tree to a canvas that is tied to the
passed document.
This method draws a NodeRenderer tree to a canvas that is tied to the
passed document.
This method (or its overloads) is the best method to use if you want to
reuse the same SVG image multiple times on the same
.
If you want to reuse this object on other
instances,
please either use any of the
overloads in this same
class and convert its result to an XObject with
this method, or look into
using
.
the
instance that contains
the renderer tree
the document that the returned
XObject
can be drawn on (on any given page
coordinates)
an
XObject
containing the PDF instructions
corresponding to the passed node renderer tree.
This method draws a NodeRenderer tree to a canvas that is tied to the
passed document.
This method draws a NodeRenderer tree to a canvas that is tied to the
passed document.
This method (or its overloads) is the best method to use if you want to
reuse the same SVG image multiple times on the same
.
If you want to reuse this object on other
instances,
please either use any of the
overloads in this same
class and convert its result to an XObject with
this method, or look into
using
.
the
instance that contains
the renderer tree
the document that the returned
the SvgDrawContext
an
XObject
containing the PDF instructions
corresponding to the passed node renderer tree.
Parse and process an Inputstream containing an SVG, using the default Svg processor (
)
The parsing of the stream is done using UTF-8 as the default charset.
Parse and process an Inputstream containing an SVG, using the default Svg processor (
)
The parsing of the stream is done using UTF-8 as the default charset.
The properties used by the processor are the
Input stream containing the SVG to parse and process
containing the root renderer and metadata of the svg
Parse and process an Inputstream containing an SVG, using the default Svg processor (
)
Stream
containing the SVG to parse and process
used by the processor
containing the root renderer and metadata of the svg
Use the default implementation of
to convert an XML
DOM tree to a node renderer tree.
the XML DOM tree
a node renderer tree corresponding to the passed XML DOM tree
Use the default implementation of
to convert an XML
DOM tree to a node renderer tree.
Use the default implementation of
to convert an XML
DOM tree to a node renderer tree. The passed properties can modify the default behaviour
the XML DOM tree
to customize the behavior
a node renderer tree corresponding to the passed XML DOM tree
Parse a String containing valid SVG into an XML DOM node, using the
default JSoup XML parser.
the String value containing valid SVG content
an XML DOM tree corresponding to the passed String input
Parse a Stream containing valid SVG into an XML DOM node, using the
default JSoup XML parser.
Parse a Stream containing valid SVG into an XML DOM node, using the
default JSoup XML parser. This method will assume that the encoding of
the Stream is
UTF-8.
the
Stream
object containing valid SVG content
an XML DOM tree corresponding to the passed String input
Parse a Stream containing valid SVG into an XML DOM node, using the
default JSoup XML parser.
Parse a Stream containing valid SVG into an XML DOM node, using the
default JSoup XML parser. This method will assume that the encoding of
the Stream is
UTF-8
, unless specified otherwise by the method
of the
parameter.
the
Stream
object containing valid SVG content
to customize the behavior
an XML DOM tree corresponding to the passed String input
Extract width and height of the passed SVGNodeRenderer,
defaulting to respective viewbox values if either one is not present or
to browser default if viewbox is missing as well
float[2], width is in position 0, height in position 1
Tries to extract charset from
.
converter properties
charset | null
Tries to extract baseUri from
.
converter properties
baseUrl | null
List to store the properties whose value can depend on parent or element font-size
Merge parent style declarations for passed styleProperty into passed style map
the styles map
the style property
the parent properties value
the parent font-size for resolving relative, font-dependent attributes
Check all inheritance rule-sets to see if the passed property is inheritable
property identifier to check
True if the property is inheritable by one of the rule-sets,
false if it is not marked as inheritable in all rule-sets
Check to see if the passed value is a measurement of the type based on the passed measurement symbol string
string containing value to check
measurement symbol (e.g. % for relative, px for pixels)
True if the value is numerical and ends with the measurement symbol, false otherwise
Helper class that allows you to check if a property is inheritable.
Set of inheritable SVG style attributes
in accordance with "http://www.w3schools.com/cssref/"
and "https://developer.mozilla.org/en-US/docs/Web/CSS/Reference"
Style and attribute inheritance resolver for
objects
Apply style and attribute inheritance to the tree formed by the root and the subTree
Renderer to consider as the root of the substree
tree of
s
Default implementation of SVG`s styles and attribute resolver .
The device description.
The list of fonts.
The resource resolver
Creates a
with a given default CSS.
the default CSS
Creates a SvgStyleResolver.
Creates a SvgStyleResolver.
Creates a SvgStyleResolver. This constructor will instantiate its internal style sheet and it
will collect the css declarations from the provided node.
node to collect css from
the processor context
Resolves node styles without inheritance of parent element styles.
the node
the CSS context (RootFontSize, etc.)
the map containing the resolved styles that are defined in the body of the element
Resolves the full path of Link href attribute,
thanks to the resource resolver.
attribute to process
Checks if string starts with #.
test string
Gets the list of fonts.
the list of
instances
Collects fonts from the style sheet.
Collects fonts from a
.
the CSS statement
Context necessary for evaluating certain Css statements whose final values depends on other statements
e.g. relative font-size statements.
Class that holds the logging and exception messages.
Message in case the font provider doesn't know about any fonts.
Exception thrown by
when it cannot process an SVG
Creates a new SvgProcessingException instance.
the message
Creates a new SvgProcessingException instance.
the message
the nested exception
Defines a property of markable elements (<path>, <line>, <polyline> or
<polygon>) which is used to determine at which verticies a marker should be drawn.
Specifies that marker will be drawn only at the first vertex of element.
Specifies that marker will be drawn at every vertex except the first and last.
Specifies that marker will be drawn only at the last vertex of element.
Default implementation of
.
Default implementation of
.
This implementation traverses the
tree depth-first,
using a stack to recreate a tree of
with the same structure.
Instantiates a DefaultSvgProcessor object.
Load in configuration, set initial processorState and create/fill-in context of the processor
that contains configuration properties and operations
Start the depth-first traversal of the INode tree, pushing the results on the stack
node to start on
Extract result from internal processorState and clean up afterwards
Root renderer of the processed SVG
Recursive visit of the object tree, depth-first, processing the visited node and calling visit on its children.
Recursive visit of the object tree, depth-first, processing the visited node and calling visit on its children.
Visit responsibilities for element nodes:
- Assign styles(CSS and attributes) to element
- Create Renderer based on element
- push and pop renderer to stack
Visit responsibilities for text nodes
- add text to parent object
INode to visit
Create renderer based on the passed SVG tag and assign its parent
SVG tag with all style attributes already assigned
renderer of the parent tag
Configured renderer for the tag
Check if this node is a text node that needs to be processed by the parent
node to check
true if the node should be processed as text, false otherwise
Process the text contained in the text-node
node containing text to process
Find the first element in the node-tree that corresponds with the passed tag-name.
Find the first element in the node-tree that corresponds with the passed tag-name. Search is performed depth-first
root-node to start with
name of the tag that needs to be fonund
IElementNode
Class that will examine the font as described in the CSS, and store it
in a form that the font provider will understand.
Name that will be used as the alias of the font.
A list of font face sources.
Create a
instance from a list of
CSS font attributes ("font-family" or "src").
the font properties
the
instance
Processes and splits a string sequence containing a url/uri
a string representing css src attribute
Gets the font-family.
Gets the font-family.
Actually font-family is an alias.
the font family (or alias)
Gets the font face sources.
the sources
Instantiates a new font face.
the font-family (or alias)
the sources
Class that defines a font face source.
The UrlPattern used to compose a source path.
The Constant TypeGroup.
The Constant UrlGroup.
The Constant FormatGroup.
The font format.
The source path.
Indicates if the font is local.
Creates a
object by parsing a
trying to match patterns that reveal the font name, whether that font is local,
and which format the font is in.
a string containing information about a font
the font in the form of a
object
Parses a
to a font format.
a string
a font format
Removes single and double quotes at the start and the end of a
.
a
that might be between quotes
the
without the quotes
Instantiates a new
instance.
a source path
indicates if the font is local
the font format (true type, open type, woff,...)
The Enum FontFormat.
"truetype"
"opentype"
"woff"
"woff2"
"embedded-opentype"
"svg"
Class that processes and add resolved css fonts to the FontProvider
Adds @font-face fonts to the FontProvider.
the css styles resolver
Creates a font and adds it to the context.
the font family
the source of the font
true, if successful
Checks whether in general we support requested font format.
true, if supported or unrecognized.
Internal ProcessorState representation for
Instantiates the processor state.
Returns the amount of ISvgNodeRenderers being processed.
amount of ISvgNodeRenderers
Adds an ISvgNodeRenderer to the processor's state.
renderer to be added to the state
Removes and returns the first renderer of the processor state.
the removed ISvgNodeRenderer object
Returns the first ISvgNodeRenderer object without removing it.
the first ISvgNodeRenderer
Returns true when the processorstate is empty, false when there is at least one ISvgNodeRenderer in the state.
true if empty, false if not empty
Default and fallback implementation of
for
The media device description.
The font provider.
The base URI.
Creates a SvgConverterProperties object.
Creates a SvgConverterProperties object. Instantiates its members, ICssResolver and ISvgNodeRenderer, to its default implementations.
Gets the base URI.
the base URI
Gets the font provider.
the font provider
Gets the media device description.
the media device description
Sets the media device description.
the media device description
the ConverterProperties instance
Sets the base URI.
the base URI
the ConverterProperties instance
Context class with accessors to properties/objects used in processing Svg documents
The font provider.
Temporary set of fonts used in the PDF.
The device description.
Instantiates a new
instance.
a
instance
Gets the font provider.
the font provider
Gets the resource resolver.
the resource resolver
Gets the device description.
the device description
Gets the temporary set of fonts.
the set of fonts
Add temporary font from @font-face.
the font program
the encoding
the alias
Add temporary font from @font-face.
the font info
the alias
A wrapper class that encapsulates processing results of
objects.
Creates new
entity.
a map of named-objects with their id's as
keys and
the
objects as values.
a wrapped
root renderer.
a
instance.
a
containing temporary fonts.
Creates new
entity.
a map of named-objects with their id's as
keys and
the
objects as values.
a wrapped
root renderer.
a
instance.
Gets processor context, containing
and
of temporary fonts inside.
instance
Interface for the configuration classes used by
Retrieve the factory responsible for creating
A
implementation
Gets the font provider.
the font provider
Get the name of the Charset to be used when decoding an InputStream.
Get the name of the Charset to be used when decoding an InputStream. This
method is allowed to return null, in which case
UTF-8
will
be used (by JSoup).
Please be aware that this method is NOT used when handling a
String
variable in the
.
the String name of the
used for decoding
Gets the base URI.
the base URI
Gets the media device description.
the media device description
Interface for SVG processors.
Interface for SVG processors.
Processors take the root
that corresponds to a Svg element
and return a
that serves as the root for the same SVG
Process an SVG, returning the root of a renderer-tree and a list
of named objects wrapped in a processor result object
Root of the INode representation of the SVG
configuration properties
root of the renderer-tree representing the SVG wrapped in {link
}
Interface for SVG processors results.
Obtains a map of named-objects with their id's as keys and the objects as values
Map of Strings as keys and
as values
Obtains the wrapped
root renderer.
ISvgNodeRenderer
Obtains the
.
FontProvider
Obtains the list of temporary fonts
FontSet
The default implementation of
that will be
used by default by the entry points defined by this project.
Default constructor with default
creation logic.
Constructor which allows injecting a custom
implementation.
the custom mapper implementation - if null, then we fall
back to the
DefaultSvgNodeRendererFactory} extension) to create extensions of the factory.
The implementation of
that will be used by
default in the
.
The implementation of
that will be used by
default in the
. It contains the mapping
of the default implementations, provided by this project for the standard SVG
tags as defined in the SVG Specification.
Interface for the factory used by
.
Interface for the factory used by
.
Pass along using
.
Create a configured renderer based on the passed Svg tag and set its parent.
Representation of the Svg tag, with all style attributes set
renderer of the parent tag
Configured ISvgNodeRenderer
Checks whether the provided tag is an ignored tag of this factory or not.
Checks whether the provided tag is an ignored tag of this factory or not. If ignored, the factory won't process this IElementNode into an ISvgNodeRenderer.
the IElementNode
true if ignored
Interface that will provide a mapping from SVG tag names to Renderers that
will be able to draw them.
Interface that will provide a mapping from SVG tag names to Renderers that
will be able to draw them. It's used in
to allow customizability in client code, and dependency injection in tests.
Gets the map from tag names to Renderer classes.
a
with Strings as keys and {link @ISvgNodeRenderer}
implementations as values
Get the list of tags that do not map to any Renderer and should be ignored
a collection of ignored tags
Interface that defines branches in the NodeRenderer structure.
Interface that defines branches in the NodeRenderer structure. Differs from a leaf renderer
in that a branch has children and as such methods that can add or retrieve those children.
Adds a renderer as the last element of the list of children.
any renderer
Gets all child renderers of this object.
the list of child renderers (in the order that they were added)
Interface implemented by elements that support marker drawing.
Interface implemented by elements that support marker drawing.
Defines methods for working with markers.
Draws a marker in the specified context.
Draws a marker in the specified context.
The marker is drawn on the vertices defined according to the given marker type.
the object that knows the place to draw this element and maintains its state
type of marker that determine on which vertices of the given element
marker should be drawn
Calculates marker orientation angle if
orient
attribute is set to
auto
marker for which the rotation angle should be calculated
indicates that the resulting angle should be rotated 180 degrees
marker orientation angle so that its positive x-axis is pointing in the direction of the path at the
point it is placed
Abstract class that will be the superclass for any element that can function
as a parent.
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.
the object that knows the place to draw this element and
maintains its state
Applies a transformation based on a viewBox for a given branch node.
current svg draw context
Applies a clipping operation based on the view port.
the svg draw context
If present, process the preserveAspectRatio position.
the svg draw context
the four values depicting the viewbox [min-x min-y width height]
alignment method to use
the multiplier for scaling width
the multiplier for scaling height
the transformation based on the preserveAspectRatio value
Cleans up the SvgDrawContext by removing the current viewport and by popping the current canvas.
context to clean
Create a deep copy of every child renderer and add them to the passed
renderer to add copies of children to
When in the svg element
overflow
is
visible
the 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.
When in the svg element
overflow
is
visible
the 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.
current context to get canvases and view ports
stream to write a BBox
abstract implementation for gradient tags
(<linearGradient>, <radialGradient>).
Creates the
that represents the corresponding gradient for specified object box
the current svg draw context
the coloring object bounding box without any adjustments
(additional stroke width or others)
the objectBoundingBoxMargin of the object bounding box
to be colored (for example - the part of stroke width
that exceeds the object bounding box, i.e. the half of stroke
width value)
current parent opacity modifier
the created color
Checks whether the gradient units values are on user space on use or object bounding box
if the 'gradientUnits' value of the gradient tag equals
to 'userSpaceOnUse', otherwise
Evaluates the 'gradientTransform' transformations
an
object representing the specified gradient transformation
Construct a list of child stop renderers
a list of
elements that represents the child stop values
Parses the gradient spread method
the parsed
specified in the gradient
abstract implementation.
Map that contains attributes and styles used for drawing operations
Retrieves the property value for a given key name or default if the property value is
or missing.
the name of the property to search for
the default value to be returned if the property is
or missing
the value for this key, or
Applies transformations set to this object, if any, and delegates the drawing of this element and its children
to the
doDraw
method.
the object that knows the place to draw this element and maintains its state
Method to see if a certain renderer can use fill.
true if the renderer can use fill
Method to see if the renderer can create a viewport
true if the renderer can construct a viewport
Return font-size of the current element
absolute value of font-size
Make a deep copy of the styles and attributes of this renderer
Helper method for deep copying logic
renderer to insert the deep copied attributes into
Draws this element to a canvas-like object maintained in the context.
the object that knows the place to draw this element and maintains its state
Evaluate the current object bounding box
the
representing the current object's bounding box
Calculate the transformation for the viewport based on the context.
Calculate the transformation for the viewport based on the context. Only used by elements that can create
viewports
the SVG draw context
the transformation that needs to be applied to this renderer
Operations to be performed after drawing the element.
Operations to be performed after drawing the element.
This includes filling, stroking.
the svg draw context
Operations to perform before drawing an element.
Operations to perform before drawing an element.
This includes setting stroke color and width, fill color.
the svg draw context
Parse absolute length.
for parsing
the value on which percent length is based on
default value if length is not recognized
current
absolute value in points
implementation for the <circle> tag.
This renderer represents a collection of elements (simple shapes and paths).
This renderer represents a collection of elements (simple shapes and paths).
The elements are not drawn visibly, but the union of their shapes will be used
to only show the parts of the drawn objects that fall within the clipping path.
In PDF, the clipping path operators use the intersection of all its elements, not the union (as in SVG);
thus, we need to draw the clipped elements multiple times if the clipping path consists of multiple elements.
implementation for the <circle> tag.
Fetches a map of String values by calling getAttribute(String s) method
and maps it's values to arc parameter cx, cy , rx, ry respectively
boolean values to indicate whether all values exit or not
This renderer represents a branch in an SVG tree.
This renderer represents a branch in an SVG tree. It doesn't do anything aside from calling the superclass doDraw.
Responsible for drawing Images to the canvas.
Responsible for drawing Images to the canvas.
Referenced SVG images aren't supported yet. TODO DEVSIX-2277
An interface containing a method to simplify working with SVG text elements.
An interface containing a method to simplify working with SVG text elements.
Must be removed in update 7.3 as the methods of this interface will be moved to
Return the bounding rectangle of the text element.
current
end point of previous text element
created instance of
implementation for the <linearGradient> tag.
implementation for the <line> tag.
implementation for the <marker> tag.
Tags mapped onto this renderer won't be drawn and will be excluded from the renderer tree when processed.
Tags mapped onto this renderer won't be drawn and will be excluded from the renderer tree when processed.
Different from being added to the ignored list as this Renderer will allow its children to be processed.
implementation for the <path> tag.
The regular expression to find invalid operators in the PathData
attribute of the <path> element
The regular expression to find invalid operators in the PathData
attribute of the <path> element
Find any occurrence of a letter that is not an operator
The regular expression to split the PathData attribute of
the <path> element
The regular expression to split the PathData attribute of
the <path> element
Since
is called before the use of this expression
in
the attribute to be split is valid.
SVG defines 6 types of path commands, for a total of 20 commands:
MoveTo: M, m
LineTo: L, l, H, h, V, v
Cubic Bezier Curve: C, c, S, s
Quadratic Bezier Curve: Q, q, T, t
Elliptical Arc Curve: A, a
ClosePath: Z, z
The
representing the current point in the path to be used for relative pathing operations.
The
representing the current point in the path to be used for relative pathing operations.
The original value is the origin, and should be set via a
operation before it may be referenced.
The
shape keeping track of the initial point set by a
operation.
The
shape keeping track of the initial point set by a
operation.
The original value is
, and must be set via a
operation before it may be drawn.
Gets the coordinates that shall be passed to
for the current shape.
The current shape.
The previous shape which can affect the coordinates of the current shape.
The operator and all arguments as an array of
String
s
a
array of coordinates that shall be passed to
Processes an individual pathing operator and all of its arguments, converting into one or more
objects.
The property operator and all arguments as an array of
s
The previous shape which can affect the positioning of the current shape. If no previous
shape exists
is passed.
a
of each
that should be drawn to represent the operator.
Processes the
and converts them
into one or more
objects to be drawn on the canvas.
Processes the
and converts them
into one or more
objects to be drawn on the canvas.
Each individual operator is passed to
to be
processed individually.
a
of each
that should be drawn to represent the path.
Iterate over the input string and separate numbers from each other with space chars
Gets an array of strings representing operators with their arguments, e.g. {"M 100 100", "L 300 100", "L200,
300", "z"}
Root renderer responsible for applying the initial axis-flipping transform
Creates a
instance.
root of the subtree
implementation for the <polygon> tag.
Calls setPoints(String) to set
Then calls
to create a path between the first and last point if it doesn't already exist
Appends the starting point to the end of
if it is not already there.
implementation for the <polyline> tag.
A List of
objects representing the path to be drawn by the polyline tag
Parses a string of space separated x,y pairs into individual
objects and appends them to
.
Parses a string of space separated x,y pairs into individual
objects and appends them to
.
Throws an
if pointsAttribute does not have a valid list of numerical x,y pairs.
A string of space separated x,y value pairs
Draws this element to a canvas-like object maintained in the context.
the object that knows the place to draw this element and maintains its state
implementation for the <rect> tag.
Constructs a RectangleSvgNodeRenderer.
a radius must be positive, and cannot be more than half the distance in
the dimension it is for.
a radius must be positive, and cannot be more than half the distance in
the dimension it is for.
e.g. rx <= width / 2
In case of a circular radius, the calculation in
isn't enough: the radius cannot be more than half of the smallest
dimension.
In case of a circular radius, the calculation in
isn't enough: the radius cannot be more than half of the smallest
dimension.
This method assumes that
has already run, and it is
silently assumed (though not necessary for this method) that either
or
is zero.
implementation for the gradient <stop> tag.
Evaluates the stop color offset value
the stop color offset value in [0, 1] range
Evaluates the rgba array of the specified stop color
the array of 4 floats which contains the rgba value corresponding
to the specified stop color
Evaluates the stop opacity of the specified stop color
the stop opacity value specified in the stop color
implementation for the <svg> tag.
Calculate the viewport based on the context.
the SVG draw context
the viewport that applies to this renderer
implementation for drawing text to a canvas.
implementation for the <text> and <tspan> tag.
Top level transformation to flip the y-axis results in the character glyphs being mirrored, this tf corrects for this behaviour
Placeholder default font-size until DEVSIX-2607 is resolved
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.
the object that knows the place to draw this element and
maintains its state
Return the font used in this text element.
Return the font used in this text element.
Note that font should already be resolved with
.
font of the current text element
Return the font size of this text element.
Return the font size of this text element.
Note that font size should already be resolved with
.
font size of current text element.
Renderer implementing the use tag.
Renderer implementing the use tag. This tag allows you to reuse previously defined elements.
Interface for SvgNodeRenderer, the renderer draws the SVG to its Pdf-canvas
passed in
, applying styling
(CSS and attributes).
Sets the parent of this renderer.
Sets the parent of this renderer. The parent may be the source of
inherited properties and default values.
the parent renderer
Gets the parent of this renderer.
Gets the parent of this renderer. The parent may be the source of
inherited properties and default values.
the parent renderer; null in case of a root node
Draws this element to a canvas-like object maintained in the context.
the object that knows the place to draw this element and
maintains its state
Sets the map of XML node attributes and CSS style properties that this
renderer needs.
the mapping from key names to values
Retrieves the property value for a given key name.
the name of the property to search for
the value for this key, or
Sets a property key and value pairs for a given attribute
the name of the attribute
the value of the attribute
Get a modifiable copy of the style and attribute map
copy of the attributes and styles-map
Creates a deep copy of this renderer, including it's subtree of children
deep copy of this renderer
This class handles common behaviour in IPathShape implementations
The properties of this shape.
Whether this is a relative operator or not.
Get bounding rectangle of the current path shape.
start point for this shape
calculated rectangle
Implements closePath(Z) attribute of SVG's path element
Implements curveTo(C) attribute of SVG's path element
Initial function of cubic bezier is f(t) = (t-1)^3*P0 + 3*(1-t)^2*t*P1 + 3*(1-t)*t^2*P2 + t^3*P3, where 0 <= t <= 1
After opening brackets it can be reduced to f(t) = a*t^3 + b*t^2 + c*t + d, where
a = P3-3*P2+3*P1-P0
b = 3*P2-6*P1+3*P0
c = 3*P1-3*P0
d = P0
First we must find the values of t at which the function reaches its extreme points.
Initial function of cubic bezier is f(t) = (t-1)^3*P0 + 3*(1-t)^2*t*P1 + 3*(1-t)*t^2*P2 + t^3*P3, where 0 <= t <= 1
After opening brackets it can be reduced to f(t) = a*t^3 + b*t^2 + c*t + d, where
a = P3-3*P2+3*P1-P0
b = 3*P2-6*P1+3*P0
c = 3*P1-3*P0
d = P0
First we must find the values of t at which the function reaches its extreme points.
This happens in the method
.
Next we get x and y values in extremes and compare it with the start and ending points coordinates to get the borders of the bounding box.
x coordinate of the starting point
y coordinate of the starting point
x coordinate of the first control point
y coordinate of the first control point
x coordinate of the second control point
y coordinate of the second control point
x coordinate of the ending point
y coordinate of the ending point
array of {xMin, yMin, xMax, yMax} values
Calculate values of t at which the function reaches its extreme points.
Calculate values of t at which the function reaches its extreme points. To do this, we get the derivative of the function and equate it to 0:
f'(t) = 3a*t^2 + 2b*t + c. This is parabola and for finding we calculate the discriminant. t can only be in the range [0, 1] and it discarded otherwise.
x coordinate of the starting point
y coordinate of the starting point
x coordinate of the first control point
y coordinate of the first control point
x coordinate of the second control point
y coordinate of the second control point
x coordinate of the ending point
y coordinate of the ending point
array of theta values corresponding to extreme points
Calculate the quadratic function 3a*t^2 + 2b*t + c = 0 to obtain the values of t
coordinate of the starting point
coordinate of the first control point
coordinate of the second control point
coordinate of the ending point
list of t values. t should be in range [0, 1]
Check that t is in the range [0, 1] and add it to list
value of t
list storing t values
Implements elliptical curveTo (A) segment of SVG's path element.
Implements elliptical curveTo (A) segment of SVG's path element. Implemented in PDF as Bézier curves.
Edge cases & value correction below always refer to https://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
For some calculations we need double precision floating point math, so we have forced all calculations to use double.
However, float comparison is used instead of double comparison, because close coordinates can be considered equal.
Creates an absolute Elliptical curveTo.
Creates a Elliptical curveTo.
Creates a Elliptical curveTo. Set argument to true to create a relative EllipticalCurveTo.
whether this is a relative EllipticalCurveTo or not
This convenience method rotates a given set of points around a given point
the input list
the rotation angle, in radians
the point to rotate around
the list of rotated points
Converts between two types of definitions of an arc:
The input is an arc defined by two points and the two semi-axes of the ellipse.
Converts between two types of definitions of an arc:
The input is an arc defined by two points and the two semi-axes of the ellipse.
The output is an arc defined by a bounding rectangle, the starting angle,
and the angular extent of the ellipse that is to be drawn.
The output is an intermediate step to calculating the Bézier curve(s) that approximate(s) the elliptical arc,
which happens in
.
Algorithm to find elliptical arc bounding box:
1.
Algorithm to find elliptical arc bounding box:
1. Compute extremes using parametric description of the whole ellipse
We use parametric description of ellipse:
x(theta) = cx + rx*cos(theta)*cos(phi) - ry*sin(theta)*sin(phi)
y(theta) = cy + rx*cos(theta)*sin(phi) + ry*sin(theta)*cos(phi)
After obtaining the derivative and equating it to zero, we get two solutions for x:
theta = -atan(ry*tan(phi)/rx) and theta = M_PI -atan(ry*tan(phi)/rx)
and two solutions for y:
theta = atan(ry/(tan(phi)*rx)) and theta = M_PI + atan(ry/(tan(phi)*rx))
Then to get theta values we need to know cx and cy - the coordinates of the center of the ellipse.
2. Compute the center of the ellipse
Method
3. Determine the bounding box of the whole ellipse
When we know cx and cy values we can get the bounding box of whole ellipse. That done in the method
.
4. Find tightest possible bounding box
Check that given points is on the arc using polar coordinates of points. Method
.
x coordinate of the starting point
y coordinate of the starting point
x radius
y radius
x-axis rotation
large arc flag. If this is true, then one of the two larger arc sweeps will be chosen (greater than or equal to 180 degrees)
sweep flag. If sweep flag is true, then the arc will be drawn in a "positive-angle" direction and if false - in a "negative-angle" direction
x coordinate of ending point
y coordinate of ending point
array of {xMin, yMin, xMax, yMax} values
Calculate the center coordinates of the whole ellipse.
Calculate the center coordinates of the whole ellipse.
Also return rx, ry values since they can be changed in this method.
Algorithm for calculation centre coordinates: https://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter
x coordinate of the starting point
y coordinate of the starting point
x radius
y radius
x-axis rotation
large arc flag
sweep flag
x coordinate of ending point
y coordinate of ending point
the array of {cx, cy, rx, ry} values
Calculate extremes of the ellipse function and corresponding angles.
Calculate extremes of the ellipse function and corresponding angles.
Angles are calculated relative to the center of the ellipse.
x radius
y radius
x-axis rotation
x coordinate of ellipse center
y coordinate of ellipse center
array of extreme coordinate and array of angles corresponding to these coordinates.
Check that angle corresponding to extreme points is on the current arc.
Check that angle corresponding to extreme points is on the current arc.
For this we check that this angle is between the angles of starting and ending points.
angle to check
angle of the first extreme point if ellipse(starting or ending)
angle of the second extreme point if ellipse(starting or ending)
if we should check that point is placed on the other arc of the current ellipse
true if point is on the arc
Return the angle between the vector (1, 0) and the line specified by points (0, 0) and (bx, by) in range [ 0,
Pi/2 ] U [ 3*Pi/2, 2*Pi).
Return the angle between the vector (1, 0) and the line specified by points (0, 0) and (bx, by) in range [ 0,
Pi/2 ] U [ 3*Pi/2, 2*Pi).
As the angle between vectors should cover the whole circle, i.e. [0, 2* Pi).
General formula to find angle between two vectors is formula F.6.5.4 on the https://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter.
x coordinate of the vector ending point
y coordinate of the vector ending point
calculated angle between vectors
Implements lineTo(H) attribute of SVG's path element
Creates an absolute Horizontal LineTo.
Creates a Horizontal LineTo.
Creates a Horizontal LineTo. Set argument to true to create a relative HorizontalLineTo.
whether this is a relative HorizontalLineTo or not
Interface that describes a Path object which is defined by control points.
Interface that describes a Path object which is defined by control points. In practice this only means Bézier curves,
both quadratic (one control point) and cubic (two control points). This interface is relevant in the context of
Smooth (Shorthand) Bézier curves, which omit a control point from their arguments list because it can be calculated
from the last control point of the previous curve. Therefore, the last control point of a curve must be exposed to
the
algorithm.
Returns coordinates of the last control point (the one closest to the ending point)
in the Bezier curve, in SVG space coordinates
coordinates of the last control point in SVG space coordinates
A locally used strategy for converting relative coordinates to absolute coordinates (in the current SVG coordinate
space).
A locally used strategy for converting relative coordinates to absolute coordinates (in the current SVG coordinate
space). Its implementation differs between Smooth (Shorthand) Bézier curves and all other path commands.
Convert an array of relative coordinates to an array with the same size containing absolute coordinates.
the initial set of coordinates
an array representing the point relative to which the relativeCoordinates are defined
a String array of absolute coordinates, with the same length as the input array
Implementation of
specifically for smooth curves.
Implementation of
specifically for smooth curves. It will convert all operators from
relative to absolute coordinates except the first coordinate pair.
This implementation is used by the Smooth (Shorthand) Bézier curve commands, because the conversion of the first
coordinate pair is calculated in
.
Default implementation of
used by the regular (not-smooth) curves and other path commands.
Default implementation of
used by the regular (not-smooth) curves and other path commands.
It will convert all operators from relative to absolute coordinates.
Implements lineTo(L) attribute of SVG's path element
Implements moveTo(M) attribute of SVG's path element
The implementation of
that will be used by
sub classes of
To map the path-data
instructions(moveto, lineto, corveto ...) to their respective implementations.
Implements quadratic Bezier curveTo(Q) attribute of SVG's path element
Draws a quadratic Bezier curve from the current point to (x,y) using (x1,y1) as the control point
The algorithm is similar to cubic curve in the method CurveTo#getBezierMinMaxPoints,
but the initial function is f(t) = (1 - t)^2*P0 + 2*(1-t)*t*P1 + t^2*P2, 0 <= t <= 1
x coordinate of the starting point
y coordinate of the starting point
x coordinate of the control point
y coordinate of the control point
x coordinate of the ending point
y coordinate of the ending point
array of {xMin, yMin, xMax, yMax} values
Calculate values of t at which the function reaches its extreme points.
Calculate values of t at which the function reaches its extreme points. To do this, we get the derivative of the
function and equate it to 0:
f'(t) = 2a*t + b. t can only be in the range [0, 1] and it discarded otherwise.
x coordinate of the starting point
y coordinate of the starting point
x coordinate of the control point
y coordinate of the control point
x coordinate of the ending point
y coordinate of the ending point
array of theta values corresponding to extreme points
Check that t is in the range [0, 1] and add it to list
value of t
list storing t values
Implements shorthand/smooth quadraticCurveTo (T) attribute of SVG's path element
Implements shorthand/smooth curveTo (S) attribute of SVG's path element
Implements lineTo(V) attribute of SVG's path element
Creates an absolute Vertical LineTo.
Creates a Vertical LineTo.
Creates a Vertical LineTo. Set argument to true to create a relative VerticalLineTo.
whether this is a relative VerticalLineTo or not
Interface for IPathShape, which draws the Path-data's d element instructions.
Draws this instruction to a canvas object.
to which this instruction is drawn
This method sets the coordinates for the path painting operator and does internal
preprocessing, if necessary
an array containing point values for path coordinates
the ending point of the previous operator, or, in broader terms,
the point that the coordinates should be absolutized against, for relative operators
Gets the ending point on the canvas after the path shape has been drawn
via the
method, in SVG space coordinates.
The
representing the final point in the drawn path.
If the point does not exist or does not change
may be returned.
Returns true when this shape is a relative operator.
Returns true when this shape is a relative operator. False if it is an absolute operator.
true if relative, false if absolute
Interface that will provide a mapping from path element-data instruction names to
.
Provides a mapping of Path-data instructions' names to path shape classes.
a
with Strings as keys and {link @
implementations as values
A factory for creating
objects.
Creates a configured
object based on the passed Svg path data instruction tag.
svg path element's path-data instruction name.
IPathShape implementation
Finds the appropriate number of arguments for a path command, based on the passed Svg path data instruction tag.
svg path element's path-data instruction name.
an integer value with the required number of arguments or null if there is no mapping for the given value
The SvgDrawContext keeps a stack of
instances, which
represent all levels of XObjects that are added to the root canvas.
Create an instance of the context that is used to store information when converting SVG.
instance of
instance of
Create an instance of the context that is used to store information when converting SVG.
instance of
instance of
svg element that is root for current file
Retrieves the current top of the stack, without modifying the stack.
the current canvas that can be used for drawing operations.
Retrieves the current top of the stack, thereby taking the current item
off the stack.
the current canvas that can be used for drawing operations.
Adds a
to the stack (by definition its top), for use in
drawing operations.
the new top of the stack
Get the current size of the stack, signifying the nesting level of the
XObjects.
the current size of the stack.
Adds a viewbox to the context.
rectangle representing the current viewbox
Get the current viewbox.
the viewbox as it is currently set
Get the viewbox which is the root viewport for the current document.
root viewbox.
Remove the currently set view box.
Adds a named object to the draw context.
Adds a named object to the draw context. These objects can then be referenced from a different tag.
name of the object
object to be referenced
Get a named object based on its name.
Get a named object based on its name. If the name isn't listed, this method will return null.
name of the object you want to reference
the referenced object
Gets the ResourceResolver to be used during the drawing operations.
resource resolver instance
* Adds a number of named object to the draw context.
* Adds a number of named object to the draw context. These objects can then be referenced from a different tag.
Map containing the named objects keyed to their ID strings
Gets the FontProvider to be used during the drawing operations.
font provider instance
Gets list of temporary fonts from @font-face.
font set instance
Sets the FontSet.
font set to be used during drawing operations
Returns true when this id has been used before
element id to check
true if id has been encountered before through a use element
Adds an ID that has been referenced by a use element.
referenced element ID
Removes an ID that has been referenced by a use element.
referenced element ID
Get the text transformation that was last applied
representing the last text transformation
Set the last text transformation
last text transformation
Get the stored current text move
[horizontal text move, vertical text move]
Reset the stored text move to [0f,0f]
Increment the stored text move
horizontal value to add
vertical value to add
Get the current canvas transformation
the
representing the current canvas transformation
Return the value of root svg element font-size
rem value
A class containing constant values signifying the proeprty names of tags, attribute, CSS-style
and certain values in SVG XML.
Class containing the constant property names for the tags in the SVG spec
Tag defining a Hyperlink.
Alternate glyphs to be used instead of regular grlyphs, e.g. ligatures, Asian scripts, ...
Defines a set of glyph substitions.
Defines a candidate set of glyph substitutions.
Not supported in PDF.
Not supported in PDF.
Not supported in PDF.
Not supported in PDF.
Tag defining a
circle.
7.1.2
Tag defining a clipping path.
Tag defining a clipping path. A clipping path defines the region where can be drawn. Anything outside the path won't be drawn.
Tag defining the color profile to be used.
Not supported in PDF
Tag defining objects that can be reused from another context
Tag defining the description of its parent element
Tag defining an
ellipse.
7.1.2
Tag defining how to blend two objects together.
Tag defining the color matrix transformations that can be performed.
Tag defining color component remapping.
Tag defining the combination of two input images.
Tag defining a matrix convolution filter
Tag defining the lighting map.
Tag defining the values to displace an image.
Tag defining a distant light source.
Tag defining the fill of a subregion.
Tag defining the transfer function for the Alpha component.
Tag defining the transfer function for the Blue component.
Tag defining the transfer function for the Green component.
Tag defining the transfer function for the Red component.
Tag defining the blur values.
Tag defining a image data from a source.
Tag defining that filters will be applied concurrently instead of sequentially.
Tag defining a node in a merge.
Tag defining the erosion or dilation of an image.
Tag defining the offset of an image.
Tag defining a point light effect.
Tag defining a lighting map.
Tag defining a spotlight.
Tag defining a fill that can be repeated.
Tag defining a fill that can be repeated. Similar to PATTERN.
Tag defining values for the perlin turbulence function.
Tag defining a collection of filter operations.
Tag defining a font.
Tag defining a font-face.
Tag defining the formats of the font.
Tag defining the name of the font.
Tag defining the source file of the font.
Tag defining the URI of a font.
Tag definign a foreign XML standard to be inserted.
Tag definign a foreign XML standard to be inserted. E.g. MathML
Tag defining a group of elements.
Tag defining a single glyph.
Tag defining a sigle glyph for altGlyph.
Tag defining the horizontal kerning values in between two glyphs.
Tag defining an image.
Tag defining a
line.
7.1.2
Tag defining a
linear gradient.
Tag defining a link
Tag defining the graphics (arrowheads or polymarkers) to be drawn at the end of paths, lines, etc.
Tag defining a mask.
Tag defining metadata.
Tag defining content to be rendered if a glyph is missing from the font.
Not supported in PDF
Tag defining a
path.
7.1.2
Tag defining a graphical object that can be repeated.
Tag defining a
polygon
shape.
7.1.2
Tag defining a
polyline
shape.
7.1.2
Tag defining a radial gradient
Tag defining a
rectangle.
7.1.2
Not supported in PDF.
Not supported in PDF.
Tag defining the ramp of colors in a gradient.
Tag defining the color in stop point of a gradient.
Tag defining the opacity in stop point of a gradient.
Tag defining the style to be.
Tag defining an
SVG
element.
7.1.2
Tag defining a switch element.
Tag defining graphical templates that can be reused by the use tag.
Tag defining text to be drawn on a page/screen.
7.1.2
Tag defining a path on which text can be drawn.
Tag defining the description of an element.
Tag defining the description of an element. Is not rendered.
Deprecated in SVG.
Deprecated in SVG. Tag defining text that was defined in an SVG document.
Tag defining a span within a text element.
Tag defining the use of a named object.
Tag defining how to view the image.
Tag defining the vertical kerning values in between two glyphs.
Class containing the constant property names for the attributes of tags in the SVG spec
Attribute defining the clipping path to be applied to a specific shape or group of shapes.
Attribute defining the clipping rule in a clipping path (or element thereof).
Attribute defining the x value of the center of a circle or ellipse.
Attribute defining the y value of the center of a circle or ellipse.
Attribute defining the outline of a shape.
Attribute defining the relative x-translation of a text-element
Attribute defining the relative y-translation of a text-element
Attribute defining the fill color.
Attribute defining the fill opacity.
Attribute defining the fill rule.
Attribute defining the font family.
Attribute defining the font weight.
Attribute defining the font style.
Attribute defining the font size.
The Constant ITALIC.
The Constant BOLD.
Attribute defining the units relation for a color gradient.
Attribute defining the transformations for a color gradient.
Attribute defining the height.
Attribute defining the height. Used in several elements.
Attribute defining the href value.
Attribute defining the unique id of an element.
Attribute defining the marker to use at the end of a path, line, polygon or polyline
Attribute defining the height of the viewport in which the marker is to be fitted
Attribute defining the marker drawn at every other vertex but the start and end of a path, line, polygon or polyline
Attribute defining the marker to use at the start of a path, line, polygon or polyline
Attribute defining the width of the viewport in which the marker is to be fitted
Attribute defining the coordinate system for attributes ‘markerWidth’, ‘markerHeight’ and the contents of the ‘marker’.
Attribute defining the offset of a stop color for gradients.
Attribute defining the opacity of a group or graphic element.
Attribute defining the orientation of a marker
Close Path Operator.
CurveTo Path Operator.
Relative CurveTo Path Operator.
Attribute defining Elliptical arc path operator.
Attribute defining Elliptical arc path operator.
Smooth CurveTo Path Operator.
Relative Smooth CurveTo Path Operator.
Absolute LineTo Path Operator.
Absolute hrizontal LineTo Path Operator.
Relative horizontal LineTo Path Operator.
Absolute vertical LineTo Path operator.
Relative vertical LineTo Path operator.
Relative LineTo Path Operator.
MoveTo Path Operator.
Relative MoveTo Path Operator.
Shorthand/smooth quadratic Bézier curveto.
Relative Shorthand/smooth quadratic Bézier curveto.
Catmull-Rom curve command.
Relative Catmull-Rom curve command.
Bearing command.
Relative Bearing command.
Quadratic CurveTo Path Operator.
Relative Quadratic CurveTo Path Operator.
Attribute defining the points of a polyline or polygon.
Attribute defining how to preserve the aspect ratio when scaling.
Attribute defining the radius of a circle.
Attribute defining the x-axis coordinate of the reference point which is to be aligned exactly at the marker position.
Attribute defining the y-axis coordinate of the reference point which is to be aligned exactly at the marker position.
Attribute defining the x-axis of an ellipse or the x-axis radius of rounded rectangles.
Attribute defining the y-axis of an ellipse or the y-axis radius of rounded rectangles.
Attribute defining the spread method for a color gradient.
Attribute defining the stroke color.
Attribute defining the stroke dash offset.
Attribute defining the stroke dash offset.
Attribute defining the stroke linecap.
Attribute defining the stroke miterlimit.
Attribute defingin the stroke opacity.
Attribute defining the stroke width.
Attribute defining the style of an element.
Attribute defining the text content of a text node.
Attribute defining the text anchor used by the text
Attribute defining a transformation that needs to be applied.
Attribute defining the viewbox of an element.
Attribute defining the width of an element.
Attribute defining the x value of an element.
Attribute defining the first x coordinate value of a line.
Attribute defining the second x coordinate value of a line.
Attribute defining image source.
Attribute defining XML namespace
Attribute defining the y value of an element.
Attribute defining the first y coordinate value of a line.
Attribute defining the second y coordinate value of a line.
Attribute defining version
Class containing the constants for values appearing in SVG tags and attributes
Value representing automatic orientation for the marker attribute orient.
Value representing reverse automatic orientation for the start marker.
Value representing the default value for the stroke linecap.
Value representing the default aspect ratio: xmidymid.
Value representing how to preserve the aspect ratio when dealing with images.
Value representing the fill rule "even odd".
Value representing the fill rule "nonzero".
Value representing the gradient units relation "objectBoundingBox".
Value representing the gradient units relation "userSpaceOnUse".
Value representing the meet for preserve aspect ratio calculations.
Value representing the "none" value".
The value representing slice for the preserve aspect ratio calculations;
The value corresponding with the namespace url for SVG.
The value corresponding with the namespace url for SVG. Will be removed since version 7.2.
Value representing the text-alignment end for text objects
Value representing the text-alignment middle for text objects
Value representing the text-alignment start for text objects
Value representing the gradient spread method "pad".
Value representing the gradient spread method "repeat".
Value representing the gradient spread method "reflect".
The value for markerUnits that represent values in a coordinate system which has a single unit equal the size in user units of the current stroke width.
Value representing how to align when scaling.
Value representing how to align when scaling.
Value representing how to align when scaling.
Value representing how to align when scaling.
Value representing how to align when scaling.
Value representing how to align when scaling.
Value representing how to align when scaling.
Value representing how to align when scaling.
Value representing how to align when scaling.
Utility class for drowing shapes on
Draw an arc on the passed canvas,
enclosed by the rectangle for which two opposite corners are specified.
Draw an arc on the passed canvas,
enclosed by the rectangle for which two opposite corners are specified.
The arc starts at the passed starting angle and extends to the starting angle + extent
corner-coordinate of the enclosing rectangle, first corner
corner-coordinate of the enclosing rectangle, first corner
corner-coordinate of the enclosing rectangle, second corner
corner-coordinate of the enclosing rectangle, second corner
starting angle in degrees
extent of the arc
canvas to paint on
Draw an arc on the passed canvas,
enclosed by the rectangle for which two opposite corners are specified.
Draw an arc on the passed canvas,
enclosed by the rectangle for which two opposite corners are specified.
The arc starts at the passed starting angle and extends to the starting angle + extent
corner-coordinate of the enclosing rectangle, first corner
corner-coordinate of the enclosing rectangle, first corner
corner-coordinate of the enclosing rectangle, second corner
corner-coordinate of the enclosing rectangle, second corner
starting angle in degrees
extent of the arc
canvas to paint on
Converts relative coordinates to absolute ones.
Converts relative coordinates to absolute ones. Assumes that relative coordinates are represented by
an array of coordinates with length proportional to the length of current coordinates array,
so that current coordinates array is applied in segments to the relative coordinates array
the initial set of coordinates
an array representing the point relative to which the relativeCoordinates are defined
a String array of absolute coordinates, with the same length as the input array
Calculate the angle between two vectors
first vector
second vector
angle between vectors in radians units
Utility class that facilitates parsing values from CSS.
Splits a given String into a list of substrings.
Splits a given String into a list of substrings.
The string is split up by commas and whitespace characters (\t, \n, \r, \f).
the string to be split
a list containing the split strings, an empty list if the value is null or empty
Converts a float pts values to pixels
the value to be converted pixels
float converted value pts/0.75f
Converts a double pts values to pixels
the value to be converted pixels
double converted value pts/0.75
Converts a float to a String.
to be converted float value
the value in a String representation
Converts a double to a String.
to be converted double value
the value in a String representation
Checks if an
represents a style sheet link.
the head child element
true, if the element node represents a style sheet link
This file is a helper class for internal usage only.
Be aware that its API and functionality may be changed in future.
Use the passed pattern to check if there's at least one match in the passed string
regex pattern that describes the match
string to search matches in
True if there's at least one match in the string, false otherwise
Class containing utility methods for text operations in the context of SVG processing
Trim all the leading whitespace characters from the passed string
string to trim
string with all leading whitespace characters removed
Trim all the trailing whitespace characters from the passed string
string to trim
string with al trailing whitespace characters removed
Process the whitespace inside the Text Tree.
Process the whitespace inside the Text Tree.
Whitespace is collapsed and new lines are handled
A leading element in each subtree is handled different: the preceding whitespace is trimmed instead of kept
root of the text-renderer subtree
true if this element is a leading element(either the first child or the first element after an absolute position change)
Check if the String is only composed of whitespace characters
string to check
true if the string only contains whitespace characters, false otherwise
Resolve the font size stored inside the passed renderer
renderer containing the font size declaration
parent font size to fall back on if the renderer does not contain a font size declarations or if the stored declaration is invalid
float containing the font-size, or the parent font size if the renderer's declaration cannot be resolved
The reference value may contain a hashtag character or 'url' designation and this method will filter them.
value to be filtered
filtered value
A rectangle adapted for working with text elements.
The y coordinate of the line on which the text is located.
Create new instance of text rectangle.
the x coordinate of lower left point
the y coordinate of lower left point
the width value
the height value
the y coordinate of the line on which the text is located.
Return the far right point of the rectangle with y on the baseline.
the far right baseline point
Utility class responsible for converting Strings containing transformation declarations
into AffineTransform objects.
Utility class responsible for converting Strings containing transformation declarations
into AffineTransform objects.
This class only supports the transformations as described in the SVG specification:
- matrix
- rotate
- scale
- skewX
- skewY
- translate
Keyword for matrix transformations.
Keyword for matrix transformations. Accepts 6 values.
matrix(0 1 2 3 4 5)
Keyword for rotation transformation.
Keyword for rotation transformation. Accepts either 1 or 3 values.
In the case of 1 value, x and y are assumed to be the origin of the user space.
rotate(angle x y)
rotate(angle)
Keyword for scale transformation.
Keyword for scale transformation. Accepts either 1 or 2 values.
In the case of 1 value, the second value is assumed to be the same as the first one.
scale(x y)
scale(x)
Keyword for skewX transformation.
Keyword for skewX transformation. Accepts 1 value.
skewX(angle)
Keyword for skewY transformation.
Keyword for skewY transformation. Accepts 1 value.
skewY(angle)
Keyword for translate transformation.
Keyword for translate transformation. Accepts either 1 or 2 values.
In the case of 1 value, the y value is assumed to be 0.
translate(x y)
translate(x)
Converts a string containing a transform declaration into an AffineTransform object.
Converts a string containing a transform declaration into an AffineTransform object.
This class only supports the transformations as described in the SVG specification:
- matrix
- translate
- skewx
- skewy
- rotate
- scale
value to be parsed
the AffineTransform object
A transformation attribute can encompass multiple transformation operation (e.g. "translate(10,20) scale(30,40)".
A transformation attribute can encompass multiple transformation operation (e.g. "translate(10,20) scale(30,40)".
This method splits the original transformation string into multiple strings so that they can be handled separately.
the transformation value
a list containing strings describing a single transformation operation
This method decides which transformation operation the given transformation strings maps onto.
string containing a transformation operation
the mapped AffineTransform object
Creates a skewY transformation.
values of the transformation
AffineTransform for the skew operation
Creates a skewX transformation.
values of the transformation
AffineTransform for the skew operation
Creates a rotate transformation.
values of the transformation
AffineTransform for the rotate operation
Creates a scale transformation.
values of the transformation
AffineTransform for the scale operation
Creates a translate transformation.
values of the transformation
AffineTransform for the translate operation
Creates a matrix transformation.
values of the transformation
AffineTransform for the matrix keyword
This method extracts the transformation name given a transformation.
the transformation
the name of the transformation
This method extracts the values from a transformation.
the transformation
values of the transformation