Hi Stefan,
Stefan Bund-4 wrote Sep 08, 2008:
> I have implemented a simple and rudimentary HTML image-map transcoder
> for batik. I know, there has already been an implementation by Thomas
> Knodt in 2002 but that seems never to have been added to the batik
> codebase.
Yes, there were some issues with that implementation.
> This is only an initial attempt and I cannot promise to work on it
> much longer, I will try. However I hope that somehow an HTML image-map
> transcoder will make it's way into batik sometime :-)
Well I'll try and take a look at it.
> Here a few words on the patch:
>
> * I added a getOutline member to SVGContext. There was already a
> getBBox call there and getOuline is just a fancy kind of bounding
> box so I thought this to be ok
Well the purpose of SVGContext is to support the SVG DOM.
So adding such a method kind of breaks that. What I would have
suggested was using the BridgeContext to lookup the associated
GraphicsNode for the DOM element.
> * The ImageMapTranscoder itself does not re-build any gvt nodes as the
> old implementation did, it instead uses SVGContext.getOutline
This is better, but I'm not sure why you didn't just lookup the
associated
GraphicsNode and call it's 'getOutline' method. You've broken
encapsulation
already when you need to cast down do a Batik DOM node to get the SVG
Context.
> * I only minimally changed the original code I found as needed to keep
> it simple for me ... it was enough trouble to find out how batik
> works :-)
So IIRC one of the _big_ problems with the original is that it didn't
deal
with transforms correctly. Do you handle transforms in the SVG document
with your image-map transcoder? Or do you assume that everything shares
the root SVG's coordinate system?
> I have not attached the code to this mail since I don't know, whether
> this is acceptable on this list. Please let me know whether I should
> post the patch here or open a bug or if you have some other way to
> contribute code.
The best way to contribute a patch would be to create a bug
report (marked as enhancement) and attach the patch there.
Thanks for taking the time to contribute back!