Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-644

DefaultExtensionHandler derived class's handlePaint is not getting invoked

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Component/s: SVGGraphics2D
    • Labels:
      None
    • Environment:
      Operating System: other
      Platform: Other

      Description

      I have following implementation to write out svg file. I have geometry with
      LinearGradient fill attribute. When I render that to the SVG2DGraphics, the
      handlePaint of the derived class is not getting invoked. Is this an known
      issue or am I missing something in my code? The following code is based on the
      example given in the svggen documentation.

      try

      { String scSvgNsURI = "http://www.w3.org/2000/svg"; DOMImplementation zDomImpl = GenericDOMImplementation.getDOMImplementation(); Document zDocument = zDomImpl.createDocument(scSvgNsURI, "svg", null); SVGGeneratorContext zSvgCtx = SVGGeneratorContext.createDefault(zDocument); GenericImageHandler zImgHandler = new CachedImageHandlerBase64Encoder(); zSvgCtx.setGenericImageHandler(zImgHandler); zSvgCtx.setExtensionHandler(new SvgExtensionHandler()); SVGGraphics2D zSvgGraphics = new SVGGraphics2D(zSvgCtx, true); IDrawingSurface zDrawingSurface = super.getDrawingSurface(); zSvgGraphics.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); zSvgGraphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); zSvgGraphics.setRenderingHint( RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); // zSvgCtx.getGraphicContextDefaults().setRenderingHints( // zSvgGraphics.getRenderingHints()); // SVGHintsDescriptor zSvgHintsDesc = // SVGRenderingHints.toSVG( // zSvgGraphics.getRenderingHints()); // // - Following code renders all the geometry primitives to the given // graphics // zDrawingSurface.render( zSvgGraphics, super.getActiveGeomContainer() ); Writer zWriter = new OutputStreamWriter( new FileOutputStream(zFile), "UTF-8"); zSvgGraphics.stream(zWriter, false); }

      catch( Exception zExcept )
      {
      }

      /**

      • Inner class to handle paint extensions.
        */
        private class SvgExtensionHandler extends DefaultExtensionHandler
        implements SVGConstants
        Unknown macro: { public SVGPaintDescriptor handlePaint( Paint zPaint, SVGGeneratorContext zContext ) { System.out.println( "HandlePaint called: " + zPaint.getClass().getName() ); } }

        Attachments

          Activity

            People

            • Assignee:
              batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
              Reporter:
              aprinaresh97@gmail.com Naresh J
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: