public final class SVGHints extends Object
SVGGraphics2D
class. The supported hints are:KEY_IMAGE_HANDLING
that controls how images are handled
(embedded in the SVG, or referenced externally);KEY_IMAGE_HREF
that allows the caller to specify the image
href attribute for the next image;KEY_TEXT_RENDERING
that allows configuration of the preferred
value of the SVG text-rendering
attribute in text elements;KEY_ELEMENT_ID
that allows the caller to specify the element
ID for the next element;KEY_BEGIN_GROUP
tells the SVGGraphics2D
instance
to start a new group element with an id equal to the hint value (which must
be an instance of String). Any other Graphics2D
implementation
will ignore this hint;KEY_END_GROUP
tells the SVGGraphics2D
instance
to end a group element. The hint value is ignored. The caller assumes
responsibility for balancing the number of KEY_BEGIN_GROUP
and
KEY_END_GROUP
hints. Any other Graphics2D
implementation will ignore this hint.Modifier and Type | Class and Description |
---|---|
static class |
SVGHints.Key
A key for hints used by the
SVGGraphics2D class. |
Modifier and Type | Field and Description |
---|---|
static SVGHints.Key |
KEY_BEGIN_GROUP
Hint key that informs the
SVGGraphics2D that the caller
would like to begin a new group element. |
static SVGHints.Key |
KEY_DRAW_STRING_TYPE
The key for the hint that controls whether strings are rendered as
characters or vector graphics (implemented using
TextLayout ). |
static SVGHints.Key |
KEY_ELEMENT_ID
Hint key to supply an element id for the next element generated.
|
static SVGHints.Key |
KEY_ELEMENT_TITLE
Hint key that informs the
SVGGraphics2D that the caller
would like to add a title element to the output (with the hint value
being a string containing the title text). |
static SVGHints.Key |
KEY_END_GROUP
Hint key that informs the
SVGGraphics2D that the caller
would like to close a previously opened group element. |
static SVGHints.Key |
KEY_IMAGE_HANDLING
The key for the hint that controls whether images are embedded in the
SVG or referenced externally.
|
static SVGHints.Key |
KEY_IMAGE_HREF
Hint key to supply string to be used as the href for an image that is
referenced rather than embedded.
|
static SVGHints.Key |
KEY_TEXT_RENDERING
The key for a hint that permits configuration of the text-rendering
attribute in SVG text elements
|
static Object |
VALUE_DRAW_STRING_TYPE_STANDARD
Hint value for
KEY_DRAW_STRING_TYPE to specify that strings
should be written to the output using standard SVG text elements. |
static Object |
VALUE_DRAW_STRING_TYPE_VECTOR
Hint value for
KEY_DRAW_STRING_TYPE to say that strings
should be written to the output using vector graphics primitives. |
static Object |
VALUE_IMAGE_HANDLING_EMBED
Hint value for
KEY_IMAGE_HANDLING to specify that images
should be embedded in the SVG output using PNG data Base64
encoded. |
static Object |
VALUE_IMAGE_HANDLING_REFERENCE
Hint value for
KEY_IMAGE_HANDLING to say that images should
be referenced externally. |
static String |
VALUE_TEXT_RENDERING_AUTO
Hint value for
KEY_TEXT_RENDERING to set the
text-rendering attribute in SVG text elements to 'auto'. |
static String |
VALUE_TEXT_RENDERING_INHERIT
Hint value for
KEY_TEXT_RENDERING to set the
text-rendering attribute in SVG text elements to
'inherit'. |
static String |
VALUE_TEXT_RENDERING_LEGIBILITY
Hint value for
KEY_TEXT_RENDERING to set the
text-rendering attribute in SVG text elements to
'optimizeLegibility'. |
static String |
VALUE_TEXT_RENDERING_PRECISION
Hint value for
KEY_TEXT_RENDERING to set the
text-rendering attribute in SVG text elements to
'geometricPrecision'. |
static String |
VALUE_TEXT_RENDERING_SPEED
Hint value for
KEY_TEXT_RENDERING to set the
text-rendering attribute in SVG text elements to
'optimizeSpeed'. |
Modifier and Type | Method and Description |
---|---|
static void |
addBeginGroupKey(RenderingHints.Key key)
Adds a key to the list of keys that are synonyms for
KEY_BEGIN_GROUP . |
static void |
addElementTitleKey(RenderingHints.Key key)
Adds a key to the list of keys that are synonyms for
KEY_ELEMENT_TITLE . |
static void |
addEndGroupKey(RenderingHints.Key key)
Adds a key to the list of keys that are synonyms for
KEY_END_GROUP . |
static void |
clearBeginGroupKeys()
Clears the list of keys that are treated as synonyms for
KEY_BEGIN_GROUP . |
static void |
clearElementTitleKeys()
Clears the list of keys that are treated as synonyms for
KEY_ELEMENT_TITLE . |
static void |
clearEndGroupKeys()
Clears the list of keys that are treated as synonyms for
KEY_END_GROUP . |
static List<RenderingHints.Key> |
getBeginGroupKeys()
Creates and returns a list of keys that are synonymous with
KEY_BEGIN_GROUP . |
static List<RenderingHints.Key> |
getElementTitleKeys()
Creates and returns a list of keys that are synonymous with
KEY_ELEMENT_TITLE . |
static List<RenderingHints.Key> |
getEndGroupKeys()
Creates and returns a list of keys that are synonymous with
KEY_END_GROUP . |
static boolean |
isBeginGroupKey(RenderingHints.Key key)
|
static boolean |
isElementTitleKey(RenderingHints.Key key)
|
static boolean |
isEndGroupKey(RenderingHints.Key key)
|
static void |
removeBeginGroupKey(RenderingHints.Key key)
Removes a key from the list of keys that are synonyms for
KEY_BEGIN_GROUP . |
static void |
removeElementTitleKey(RenderingHints.Key key)
Removes a key from the list of keys that are synonyms for
KEY_ELEMENT_TITLE . |
static void |
removeEndGroupKey(RenderingHints.Key key)
Removes a key from the list of keys that are synonyms for
KEY_END_GROUP . |
public static final SVGHints.Key KEY_IMAGE_HANDLING
VALUE_IMAGE_HANDLING_EMBED
and
VALUE_IMAGE_HANDLING_REFERENCE
.public static final Object VALUE_IMAGE_HANDLING_EMBED
KEY_IMAGE_HANDLING
to specify that images
should be embedded in the SVG output using PNG data Base64
encoded.public static final Object VALUE_IMAGE_HANDLING_REFERENCE
KEY_IMAGE_HANDLING
to say that images should
be referenced externally.public static final SVGHints.Key KEY_TEXT_RENDERING
public static final String VALUE_TEXT_RENDERING_AUTO
KEY_TEXT_RENDERING
to set the
text-rendering
attribute in SVG text elements to 'auto'.public static final String VALUE_TEXT_RENDERING_SPEED
KEY_TEXT_RENDERING
to set the
text-rendering
attribute in SVG text elements to
'optimizeSpeed'.public static final String VALUE_TEXT_RENDERING_LEGIBILITY
KEY_TEXT_RENDERING
to set the
text-rendering
attribute in SVG text elements to
'optimizeLegibility'.public static final String VALUE_TEXT_RENDERING_PRECISION
KEY_TEXT_RENDERING
to set the
text-rendering
attribute in SVG text elements to
'geometricPrecision'.public static final String VALUE_TEXT_RENDERING_INHERIT
KEY_TEXT_RENDERING
to set the
text-rendering
attribute in SVG text elements to
'inherit'.public static final SVGHints.Key KEY_IMAGE_HREF
public static final SVGHints.Key KEY_ELEMENT_ID
public static final SVGHints.Key KEY_BEGIN_GROUP
SVGGraphics2D
that the caller
would like to begin a new group element. The hint value is the id for
the new group. After opening the new group the hint is cleared and it
is the caller's responsibility to close the group later using
KEY_END_GROUP
. Groups can be nested.public static final SVGHints.Key KEY_END_GROUP
SVGGraphics2D
that the caller
would like to close a previously opened group element. The hint
value is ignored.public static final SVGHints.Key KEY_ELEMENT_TITLE
SVGGraphics2D
that the caller
would like to add a title element to the output (with the hint value
being a string containing the title text).public static final SVGHints.Key KEY_DRAW_STRING_TYPE
TextLayout
).
The latter will result in larger output files but avoids problems with
fonts not being available for the viewer. Valid hint values are
VALUE_DRAW_STRING_TYPE_STANDARD
and
VALUE_DRAW_STRING_TYPE_VECTOR
.public static final Object VALUE_DRAW_STRING_TYPE_STANDARD
KEY_DRAW_STRING_TYPE
to specify that strings
should be written to the output using standard SVG text elements.public static final Object VALUE_DRAW_STRING_TYPE_VECTOR
KEY_DRAW_STRING_TYPE
to say that strings
should be written to the output using vector graphics primitives.public static List<RenderingHints.Key> getBeginGroupKeys()
KEY_BEGIN_GROUP
.null
).public static void addBeginGroupKey(RenderingHints.Key key)
KEY_BEGIN_GROUP
.key
- the key (null
not permitted).public static void removeBeginGroupKey(RenderingHints.Key key)
KEY_BEGIN_GROUP
.key
- the key (null
not permitted).public static void clearBeginGroupKeys()
KEY_BEGIN_GROUP
.public static boolean isBeginGroupKey(RenderingHints.Key key)
true
if this key is equivalent to
KEY_BEGIN_GROUP
, and false
otherwise. The purpose
of this method is to allow certain keys from external packages (such as
JFreeChart and Orson Charts) to use their own keys to drive the
behaviour of SVGHints.KEY_BEGIN_GROUP
. This has two benefits:
(1) it avoids the necessity to make JFreeSVG a direct dependency, and
(2) it makes the grouping behaviour generic from the point of view of
the external package, rather than SVG-specific.key
- the key (null
not permitted)public static List<RenderingHints.Key> getEndGroupKeys()
KEY_END_GROUP
.null
).public static void addEndGroupKey(RenderingHints.Key key)
KEY_END_GROUP
.key
- the key (null
not permitted).public static void removeEndGroupKey(RenderingHints.Key key)
KEY_END_GROUP
.key
- the key (null
not permitted).public static void clearEndGroupKeys()
KEY_END_GROUP
.public static boolean isEndGroupKey(RenderingHints.Key key)
true
if this key is equivalent to
KEY_END_GROUP
, and false
otherwise. The purpose
of this method is to allow certain keys from external packages (such as
JFreeChart and Orson Charts) to use their own keys to drive the
behaviour of SVGHints.KEY_END_GROUP
. This has two benefits:
(1) it avoids the necessity to make JFreeSVG a direct dependency, and
(2) it makes the grouping behaviour generic from the point of view of
the external package, rather than SVG-specific.key
- the key (null
not permitted).public static List<RenderingHints.Key> getElementTitleKeys()
KEY_ELEMENT_TITLE
.null
).public static void addElementTitleKey(RenderingHints.Key key)
KEY_ELEMENT_TITLE
.key
- the key (null
not permitted).public static void removeElementTitleKey(RenderingHints.Key key)
KEY_ELEMENT_TITLE
.key
- the key (null
not permitted).public static void clearElementTitleKeys()
KEY_ELEMENT_TITLE
.public static boolean isElementTitleKey(RenderingHints.Key key)
true
if this key is equivalent to
KEY_ELEMENT_TITLE
, and false
otherwise. The
purpose of this method is to allow certain keys from external packages
(such as JFreeChart and Orson Charts) to use their own keys to drive the
behaviour of SVGHints.KEY_ELEMENT_TITLE
. This has two benefits:
(1) it avoids the necessity to make JFreeSVG a direct dependency, and
(2) it makes the element title behaviour generic from the point of view
of the external package, rather than SVG-specific.key
- the key (null
not permitted)Copyright © 2021. All rights reserved.