Class SvgBaseTranscoder

    • Field Detail

      • externalPrintWriter

        protected java.io.PrintWriter externalPrintWriter
        Print writer that outputs the full class.
      • printWriterManager

        private SvgBaseTranscoder.PrintWriterManager printWriterManager
        Print writer that is used during the transcoding traversal to buffer the rendering instructions.
      • classname

        private java.lang.String classname
      • packageName

        private java.lang.String packageName
      • hasRasters

        private boolean hasRasters
      • TOKEN_RASTER_CODE

        private static final java.lang.String TOKEN_RASTER_CODE
        See Also:
        Constant Field Values
      • TOKEN_SET_COLOR_FILTER

        private static final java.lang.String TOKEN_SET_COLOR_FILTER
        See Also:
        Constant Field Values
      • TOKEN_SUPPORTS_COLOR_FILTER

        private static final java.lang.String TOKEN_SUPPORTS_COLOR_FILTER
        See Also:
        Constant Field Values
      • TOKEN_PAINTING_CODE

        private static final java.lang.String TOKEN_PAINTING_CODE
        See Also:
        Constant Field Values
      • TOKEN_PAINTING_INVOCATIONS

        private static final java.lang.String TOKEN_PAINTING_INVOCATIONS
        See Also:
        Constant Field Values
      • TOKEN_ORIG_WIDTH

        private static final java.lang.String TOKEN_ORIG_WIDTH
        See Also:
        Constant Field Values
      • TOKEN_ORIG_HEIGHT

        private static final java.lang.String TOKEN_ORIG_HEIGHT
        See Also:
        Constant Field Values
    • Constructor Detail

      • SvgBaseTranscoder

        public SvgBaseTranscoder​(java.lang.String classname,
                                 LanguageRenderer languageRenderer)
        Creates a new transcoder.
        Parameters:
        classname - Classname for the generated Java2D code.
        languageRenderer - Language renderer (Java, Kotlin, ...)
    • Method Detail

      • setPackageName

        public void setPackageName​(java.lang.String packageName)
      • setListener

        public void setListener​(TranscoderListener listener)
        Sets the listener.
        Parameters:
        listener - Listener.
      • setPrintWriter

        public void setPrintWriter​(java.io.PrintWriter printWriter)
      • transcode

        public void transcode​(org.apache.batik.gvt.GraphicsNode gvtRoot,
                              java.io.InputStream templateStream)
        Transcodes the SVG image into Java2D code.
        Parameters:
        gvtRoot - Graphics vector tree root.
        templateStream - Stream with the template content.
      • transcodePathIterator

        private void transcodePathIterator​(java.awt.geom.PathIterator pathIterator,
                                           java.lang.String suffix)
        Transcodes the specified path iterator.
        Parameters:
        pathIterator - Path iterator.
      • transcodeShape

        private void transcodeShape​(java.awt.Shape shape,
                                    java.lang.String suffix)
                             throws java.lang.UnsupportedOperationException
        Transcodes the specified shape.
        Parameters:
        shape - Shape.
        Throws:
        java.lang.UnsupportedOperationException - if the shape is unsupported.
      • transcodeLinearGradientPaint

        private void transcodeLinearGradientPaint​(org.apache.batik.ext.awt.LinearGradientPaint paint)
                                           throws java.lang.IllegalArgumentException
        Transcodes the specified linear gradient paint.
        Parameters:
        paint - Linear gradient paint.
        Throws:
        java.lang.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 java.lang.IllegalArgumentException
        Transcodes the specified radial gradient paint.
        Parameters:
        paint - Radial gradient paint.
        Throws:
        java.lang.IllegalArgumentException - if the fractions are not strictly increasing.
      • transcodePaint

        private void transcodePaint​(java.awt.Paint paint)
                             throws java.lang.UnsupportedOperationException
        Transcodes the specified paint.
        Parameters:
        paint - Paint.
        Throws:
        java.lang.UnsupportedOperationException - if the paint is unsupported.
      • transcodePaintAndFill

        private void transcodePaintAndFill​(java.awt.Paint paint)
                                    throws java.lang.UnsupportedOperationException
        Transcodes the specified paint.
        Parameters:
        paint - Paint.
        Throws:
        java.lang.UnsupportedOperationException - if the paint is unsupported.
      • transcodeShapePainter

        private void transcodeShapePainter​(org.apache.batik.gvt.ShapePainter painter,
                                           java.awt.Shape shape,
                                           java.lang.String comment)
                                    throws java.lang.UnsupportedOperationException
        Transcodes the specified shape painter.
        Parameters:
        painter - Shape painter.
        Throws:
        java.lang.UnsupportedOperationException - if the shape painter is unsupported.
      • transcodeCompositeShapePainter

        private void transcodeCompositeShapePainter​(org.apache.batik.gvt.CompositeShapePainter painter,
                                                    java.awt.Shape shape,
                                                    java.lang.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,
                                                 java.awt.Shape shape,
                                                 java.lang.String comment)
        Transcodes the specified marker shape painter.
        Parameters:
        painter - Marker shape painter.
      • rotate

        private void rotate​(double angle)
      • transcodeShapeNode

        private void transcodeShapeNode​(org.apache.batik.gvt.ShapeNode node,
                                        java.lang.String comment)
        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,
                                                    java.lang.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

        private void transcodeRenderedImage​(java.awt.image.RenderedImage image,
                                            java.lang.String graphicsName)
      • transcodeRasterImageNode

        private void transcodeRasterImageNode​(org.apache.batik.gvt.RasterImageNode node,
                                              java.lang.String comment)
      • transcodeTextNode

        private void transcodeTextNode​(org.apache.batik.bridge.TextNode node,
                                       java.lang.String comment)
      • transcodeGraphicsNode

        private void transcodeGraphicsNode​(org.apache.batik.gvt.GraphicsNode node,
                                           java.lang.String comment)
                                    throws java.lang.UnsupportedOperationException
        Transcodes the specified graphics node.
        Parameters:
        node - Graphics node.
        comment - Comment (for associating the Java2D section with the corresponding SVG section).
        Throws:
        java.lang.UnsupportedOperationException - if the graphics node is unsupported.
      • isNonIdentityTransform

        private boolean isNonIdentityTransform​(java.awt.geom.AffineTransform transform)