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 String
protected PrintWriter
Print writer that outputs the full class.private boolean
private LanguageRenderer
protected TranscoderListener
Listener.private String
Print writer that is used during the transcoding traversal to buffer the rendering instructions.private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
-
Constructor Summary
ConstructorsConstructorDescriptionSvgBaseTranscoder
(String classname, LanguageRenderer languageRenderer) Creates a new transcoder. -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
isNonIdentityTransform
(AffineTransform transform) private void
rotate
(double angle) void
setListener
(TranscoderListener listener) Sets the listener.void
setPackageName
(String packageName) void
setPrintWriter
(PrintWriter printWriter) void
transcode
(org.apache.batik.gvt.GraphicsNode gvtRoot, InputStream templateStream) Transcodes the SVG image into Java2D code.private void
transcodeCompositeGraphicsNode
(org.apache.batik.gvt.CompositeGraphicsNode node, String comment) Transcodes the specified composite graphics node.private void
transcodeCompositeShapePainter
(org.apache.batik.gvt.CompositeShapePainter painter, Shape shape, String comment) Transcodes the specified composite shape painter.private void
transcodeFillShapePainter
(org.apache.batik.gvt.FillShapePainter painter) Transcodes the specified fill shape painter.private void
transcodeGraphicsNode
(org.apache.batik.gvt.GraphicsNode node, String comment) Transcodes the specified graphics node.private void
transcodeLinearGradientPaint
(org.apache.batik.ext.awt.LinearGradientPaint paint) Transcodes the specified linear gradient paint.private void
transcodeMarkerShapePainter
(org.apache.batik.gvt.MarkerShapePainter painter, Shape shape, String comment) Transcodes the specified marker shape painter.private void
transcodePaint
(Paint paint) Transcodes the specified paint.private void
transcodePaintAndFill
(Paint paint) Transcodes the specified paint.private void
transcodePathIterator
(PathIterator pathIterator, String suffix) Transcodes the specified path iterator.private void
transcodePatternPaint
(org.apache.batik.gvt.PatternPaint paint) private void
transcodeRadialGradientPaint
(org.apache.batik.ext.awt.RadialGradientPaint paint) Transcodes the specified radial gradient paint.private void
transcodeRasterImageNode
(org.apache.batik.gvt.RasterImageNode node, String comment) private void
transcodeRenderedImage
(RenderedImage image, String graphicsName) private void
transcodeShape
(Shape shape, String suffix) Transcodes the specified shape.private void
transcodeShapeNode
(org.apache.batik.gvt.ShapeNode node, String comment) Transcodes the specified shape node.private void
transcodeShapePainter
(org.apache.batik.gvt.ShapePainter painter, Shape shape, String comment) Transcodes the specified shape painter.private void
transcodeStrokeShapePainter
(org.apache.batik.gvt.StrokeShapePainter painter) Transcodes the specified stroke shape painter.private void
transcodeTextNode
(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
private void transcodeCompositeShapePainter(org.apache.batik.gvt.CompositeShapePainter painter, Shape shape, String comment) Transcodes the specified composite shape painter.- Parameters:
painter
- Composite shape painter.
-
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
private void transcodeMarkerShapePainter(org.apache.batik.gvt.MarkerShapePainter painter, Shape shape, String comment) Transcodes the specified marker shape painter.- Parameters:
painter
- Marker shape painter.
-
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
-