Package org.apache.batik.svggen
Class SVGGeneratorContext
java.lang.Object
org.apache.batik.svggen.SVGGeneratorContext
- All Implemented Interfaces:
ErrorConstants
This class contains all non graphical contextual information that
are needed by the
SVGGraphics2D
to
generate SVG from Java 2D primitives.
You can subclass it to change the defaults.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class to describe the GraphicContext defaults to be used. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DecimalFormat
Current double value formatterprotected static DecimalFormat[]
protected static DecimalFormatSymbols
Fields inherited from interface org.apache.batik.svggen.ErrorConstants
ERR_ACI, ERR_CANNOT_USE_IMAGE_DIR, ERR_CANVAS_SIZE_NULL, ERR_CLIP_NULL, ERR_CONTEXT_NULL, ERR_DOM_FACTORY_NULL, ERR_DOMTREEMANAGER_NULL, ERR_ERROR_HANDLER_NULL, ERR_EXTENSION_HANDLER_NULL, ERR_FONT_NULL, ERR_GC_NULL, ERR_HINT_NULL, ERR_ID_GENERATOR_NULL, ERR_ILLEGAL_BUFFERED_IMAGE_LOOKUP_OP, ERR_ILLEGAL_BUFFERED_IMAGE_RESCALE_OP, ERR_IMAGE_DIR_DOES_NOT_EXIST, ERR_IMAGE_DIR_NULL, ERR_IMAGE_HANDLER_NOT_SUPPORTED, ERR_IMAGE_HANDLER_NULL, ERR_IMAGE_NULL, ERR_MAP_NULL, ERR_MAXGCOVERRIDES_OUTOFRANGE, ERR_PROXY, ERR_READ, ERR_SCALE_FACTORS_AND_OFFSETS_MISMATCH, ERR_STROKE_NULL, ERR_STYLE_HANDLER_NULL, ERR_TOP_LEVEL_GROUP_NOT_G, ERR_TOP_LEVEL_GROUP_NULL, ERR_TRANS_NULL, ERR_UNEXPECTED, ERR_WRITE, ERR_XOR, INVALID_NODE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SVGGeneratorContext
(Document domFactory) Builds an instance ofSVGGeneratorContext
with the givendomFactory
but let the user set later the other contextual information. -
Method Summary
Modifier and TypeMethodDescriptionstatic SVGGeneratorContext
createDefault
(Document domFactory) Creates an instance ofSVGGeneratorContext
with the givendomFactory
and with the default values for the other information.final String
doubleString
(double value) Converts the input double value to a string with a number of decimal places controlled by the precision attribute.final String
Returns the comment to be generated in the SVG file.final Document
Returns the DOM Factory that has been set.final ErrorHandler
Returns theErrorHandler
that has been set.final ExtensionHandler
Returns theExtensionHandler
that has been set.Returns the set of defaults which should be used for the GraphicContext.final SVGIDGenerator
Returns theSVGIDGenerator
that has been set.final ImageHandler
Returns theImageHandler
that has been set.final int
Returns the current precision used by this contextfinal StyleHandler
Returns theStyleHandler
that has been set.final boolean
Returnstrue
if we should generate SVG Fonts for texts.final void
setComment
(String generatorComment) Sets the comment to be used.final void
setDOMFactory
(Document domFactory) Sets the DOM Factory to be used.final void
setEmbeddedFontsOn
(boolean svgFont) Sets if we should generate SVG Fonts for texts.final void
setErrorHandler
(ErrorHandler errorHandler) Sets theErrorHandler
to be used.final void
setExtensionHandler
(ExtensionHandler extensionHandler) Sets theExtensionHandler
to be used.final void
setGenericImageHandler
(GenericImageHandler genericImageHandler) Sets theGenericImageHandler
to be used.final void
Sets the default to be used for the graphic context.final void
setIDGenerator
(SVGIDGenerator idGenerator) Sets theSVGIDGenerator
to be used.final void
setImageHandler
(ImageHandler imageHandler) Sets theImageHandler
to be used.final void
setPrecision
(int precision) Sets the precision used by this context.final void
setStyleHandler
(StyleHandler styleHandler) Sets theStyleHandler
to be used.
-
Field Details
-
decimalFormat
Current double value formatter -
dsf
-
decimalFormats
-
-
Constructor Details
-
SVGGeneratorContext
Builds an instance ofSVGGeneratorContext
with the givendomFactory
but let the user set later the other contextual information. Please note that none of the parameter below should benull
.
-
-
Method Details
-
createDefault
Creates an instance ofSVGGeneratorContext
with the givendomFactory
and with the default values for the other information. -
getGraphicContextDefaults
Returns the set of defaults which should be used for the GraphicContext. -
setGraphicContextDefaults
Sets the default to be used for the graphic context. Note that gcDefaults may be null and that any of its attributes may be null. -
getIDGenerator
Returns theSVGIDGenerator
that has been set. -
setIDGenerator
Sets theSVGIDGenerator
to be used. It should not benull
. -
getDOMFactory
Returns the DOM Factory that has been set. -
setDOMFactory
Sets the DOM Factory to be used. It should not benull
. -
getExtensionHandler
Returns theExtensionHandler
that has been set. -
setExtensionHandler
Sets theExtensionHandler
to be used. It should not benull
. -
getImageHandler
Returns theImageHandler
that has been set. -
setImageHandler
Sets theImageHandler
to be used. It should not benull
. -
setGenericImageHandler
Sets theGenericImageHandler
to be used. -
getStyleHandler
Returns theStyleHandler
that has been set. -
setStyleHandler
Sets theStyleHandler
to be used. It should not benull
. -
getComment
Returns the comment to be generated in the SVG file. -
setComment
Sets the comment to be used. It can benull
if you want to disable it. -
getErrorHandler
Returns theErrorHandler
that has been set. -
setErrorHandler
Sets theErrorHandler
to be used. It should not benull
. -
isEmbeddedFontsOn
public final boolean isEmbeddedFontsOn()Returnstrue
if we should generate SVG Fonts for texts. -
setEmbeddedFontsOn
public final void setEmbeddedFontsOn(boolean svgFont) Sets if we should generate SVG Fonts for texts. Default value isfalse
. -
getPrecision
public final int getPrecision()Returns the current precision used by this context -
setPrecision
public final void setPrecision(int precision) Sets the precision used by this context. The precision controls the number of decimal places used in floating point values output by the SVGGraphics2D generator. Note that the precision is clipped to the [0,12] range. -
doubleString
Converts the input double value to a string with a number of decimal places controlled by the precision attribute.
-