Class SvgBaseTranscoder
java.lang.Object
org.pushingpixels.radiance.tools.svgtranscoder.api.SvgBaseTranscoder
- Direct Known Subclasses:
SvgStreamTranscoder, SvgTranscoder
SVG to Java2D transcoder.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprotected PrintWriterPrint writer that outputs the full class.private booleanprivate LanguageRendererprotected TranscoderListenerListener.private StringPrint writer that is used during the transcoding traversal to buffer the rendering instructions.private static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final String -
Constructor Summary
ConstructorsConstructorDescriptionSvgBaseTranscoder(String classname, LanguageRenderer languageRenderer) Creates a new transcoder. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanisNonIdentityTransform(AffineTransform transform) private voidrotate(double angle) voidsetListener(TranscoderListener listener) Sets the listener.voidsetPackageName(String packageName) voidsetPrintWriter(PrintWriter printWriter) voidtranscode(org.apache.batik.gvt.GraphicsNode gvtRoot, InputStream templateStream) Transcodes the SVG image into Java2D code.private voidtranscodeCompositeGraphicsNode(org.apache.batik.gvt.CompositeGraphicsNode node, String comment) Transcodes the specified composite graphics node.private voidtranscodeCompositeShapePainter(org.apache.batik.gvt.CompositeShapePainter painter, Shape shape, String comment) Transcodes the specified composite shape painter.private voidtranscodeFillShapePainter(org.apache.batik.gvt.FillShapePainter painter) Transcodes the specified fill shape painter.private voidtranscodeGraphicsNode(org.apache.batik.gvt.GraphicsNode node, String comment) Transcodes the specified graphics node.private voidtranscodeLinearGradientPaint(org.apache.batik.ext.awt.LinearGradientPaint paint) Transcodes the specified linear gradient paint.private voidtranscodeMarkerShapePainter(org.apache.batik.gvt.MarkerShapePainter painter, Shape shape, String comment) Transcodes the specified marker shape painter.private voidtranscodePaint(Paint paint) Transcodes the specified paint.private voidtranscodePaintAndFill(Paint paint) Transcodes the specified paint.private voidtranscodePathIterator(PathIterator pathIterator, String suffix) Transcodes the specified path iterator.private voidtranscodePatternPaint(org.apache.batik.gvt.PatternPaint paint) private voidtranscodeRadialGradientPaint(org.apache.batik.ext.awt.RadialGradientPaint paint) Transcodes the specified radial gradient paint.private voidtranscodeRasterImageNode(org.apache.batik.gvt.RasterImageNode node, String comment) private voidtranscodeRenderedImage(RenderedImage image, String graphicsName) private voidtranscodeShape(Shape shape, String suffix) Transcodes the specified shape.private voidtranscodeShapeNode(org.apache.batik.gvt.ShapeNode node, String comment) Transcodes the specified shape node.private voidtranscodeShapePainter(org.apache.batik.gvt.ShapePainter painter, Shape shape, String comment) Transcodes the specified shape painter.private voidtranscodeStrokeShapePainter(org.apache.batik.gvt.StrokeShapePainter painter) Transcodes the specified stroke shape painter.private voidtranscodeTextNode(org.apache.batik.bridge.TextNode node, String comment)
-
Field Details
-
listener
Listener. -
externalPrintWriter
Print writer that outputs the full class. -
printWriterManager
Print writer that is used during the transcoding traversal to buffer the rendering instructions. -
languageRenderer
-
classname
-
packageName
-
hasRasters
private boolean hasRasters -
TOKEN_PACKAGE
- See Also:
-
TOKEN_CLASSNAME
- See Also:
-
TOKEN_RASTER_CODE
- See Also:
-
TOKEN_SET_COLOR_FILTER
- See Also:
-
TOKEN_SUPPORTS_COLOR_FILTER
- See Also:
-
TOKEN_PAINTING_CODE
- See Also:
-
TOKEN_PAINTING_INVOCATIONS
- See Also:
-
TOKEN_ORIG_X
- See Also:
-
TOKEN_ORIG_Y
- See Also:
-
TOKEN_ORIG_WIDTH
- See Also:
-
TOKEN_ORIG_HEIGHT
- See Also:
-
-
Constructor Details
-
SvgBaseTranscoder
Creates a new transcoder.- Parameters:
classname- Classname for the generated Java2D code.languageRenderer- Language renderer (Java, Kotlin, ...)
-
-
Method Details
-
setPackageName
-
setListener
Sets the listener.- Parameters:
listener- Listener.
-
setPrintWriter
-
transcode
Transcodes the SVG image into Java2D code.- Parameters:
gvtRoot- Graphics vector tree root.templateStream- Stream with the template content.
-
transcodePathIterator
Transcodes the specified path iterator.- Parameters:
pathIterator- Path iterator.
-
transcodeShape
Transcodes the specified shape.- Parameters:
shape- Shape.- Throws:
UnsupportedOperationException- if the shape is unsupported.
-
transcodeLinearGradientPaint
private void transcodeLinearGradientPaint(org.apache.batik.ext.awt.LinearGradientPaint paint) throws IllegalArgumentException Transcodes the specified linear gradient paint.- Parameters:
paint- Linear gradient paint.- Throws:
IllegalArgumentException- if the fractions are not strictly increasing.
-
transcodePatternPaint
private void transcodePatternPaint(org.apache.batik.gvt.PatternPaint paint) -
transcodeRadialGradientPaint
private void transcodeRadialGradientPaint(org.apache.batik.ext.awt.RadialGradientPaint paint) throws IllegalArgumentException Transcodes the specified radial gradient paint.- Parameters:
paint- Radial gradient paint.- Throws:
IllegalArgumentException- if the fractions are not strictly increasing.
-
transcodePaint
Transcodes the specified paint.- Parameters:
paint- Paint.- Throws:
UnsupportedOperationException- if the paint is unsupported.
-
transcodePaintAndFill
Transcodes the specified paint.- Parameters:
paint- Paint.- Throws:
UnsupportedOperationException- if the paint is unsupported.
-
transcodeShapePainter
private void transcodeShapePainter(org.apache.batik.gvt.ShapePainter painter, Shape shape, String comment) throws UnsupportedOperationException Transcodes the specified shape painter.- Parameters:
painter- Shape painter.- Throws:
UnsupportedOperationException- if the shape painter is unsupported.
-
transcodeCompositeShapePainter
-
transcodeFillShapePainter
private void transcodeFillShapePainter(org.apache.batik.gvt.FillShapePainter painter) Transcodes the specified fill shape painter.- Parameters:
painter- Fill shape painter.
-
transcodeStrokeShapePainter
private void transcodeStrokeShapePainter(org.apache.batik.gvt.StrokeShapePainter painter) Transcodes the specified stroke shape painter.- Parameters:
painter- Stroke shape painter.
-
transcodeMarkerShapePainter
-
rotate
private void rotate(double angle) -
transcodeShapeNode
Transcodes the specified shape node.- Parameters:
node- Shape node.comment- Comment (for associating the Java2D section with the corresponding SVG section).
-
transcodeCompositeGraphicsNode
private void transcodeCompositeGraphicsNode(org.apache.batik.gvt.CompositeGraphicsNode node, String comment) Transcodes the specified composite graphics node.- Parameters:
node- Composite graphics node.comment- Comment (for associating the Java2D section with the corresponding SVG section).
-
transcodeRenderedImage
-
transcodeRasterImageNode
-
transcodeTextNode
-
transcodeGraphicsNode
private void transcodeGraphicsNode(org.apache.batik.gvt.GraphicsNode node, String comment) throws UnsupportedOperationException Transcodes the specified graphics node.- Parameters:
node- Graphics node.comment- Comment (for associating the Java2D section with the corresponding SVG section).- Throws:
UnsupportedOperationException- if the graphics node is unsupported.
-
isNonIdentityTransform
-