Bug 39714 - DefaultExtensionHandler derived class's handlePaint is not getting invoked
Summary: DefaultExtensionHandler derived class's handlePaint is not getting invoked
Status: NEEDINFO
Alias: None
Product: Batik - Now in Jira
Classification: Unclassified
Component: SVGGraphics2D (show other bugs)
Version: 1.6
Hardware: Other other
: P2 normal
Target Milestone: ---
Assignee: Batik Developer's Mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-04 01:49 UTC by Naresh J
Modified: 2007-09-24 19:15 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Naresh J 2006-06-04 01:49:59 UTC
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
   {
      public SVGPaintDescriptor handlePaint( Paint               zPaint,
                                             SVGGeneratorContext zContext ) 
      {
         System.out.println( "HandlePaint called: " +
                            zPaint.getClass().getName() );
      }
   }
Comment 1 Thomas Deweese 2006-06-05 23:18:27 UTC
I've looked at the code (yours and Batik's) and it all seems good.
Can you provide a standalone test case that reproduces the problem?