Details
-
Bug
-
Status: Open
-
Resolution: Unresolved
-
1.6
-
None
-
None
-
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 SVGConstantsUnknown macro: { public SVGPaintDescriptor handlePaint( Paint zPaint, SVGGeneratorContext zContext ) { System.out.println( "HandlePaint called: " + zPaint.getClass().getName() ); } }