I've inherited a Java GUI that uses the JSVGCanvas object (through a derived class) inside a JScrollPane. Objects which are derived from JComponent are then added to the JSVGCanvas
object using the JSVGCanvas.add() method. The user can zoom in and out of the SVG. This is implemented
by a mouse event handler on the JSVGCanvas derived
class which calls JSVGCanvas.getRenderingTransform(), manipulates the AffineTransform
then applies it by calling JSVGCanvas.setRenderingTransform().
The objects placed on top of the JSVGCanvas
(via calls to add()) are then scaled using the same
transform via a code in the gvtRenderingCompleted() event
handler (although this code has also been called from gvtRenderingStarted()
and also in the mouse handler (where the transform is being manipulated) during
attempts to fix the problems we are encountering). The code all worked in Batik v1.1.1 and as the user zoomed
in and out of the SVG the objects on top were also scaled to keep them
synchronised with the SVG. However when we moved to Batik v1.5 (in an effort to reduce
the amount of memory that appeared to be leaked when loading new SVGs and zooming them) we noticed that the SVG and the objects
were no longer being synchronised when the SVG was being manipulated. After a
bit of investigation it appears that the scaling of the objects is causing the
SVG to be re-rendered such that the following appears to be happening: Render the SVG at the new scale. Render the objects at the new scale. Render the SVG at the new scale again. This also happened in Batik v1.1.1, however the difference
between the two versions appears to be that when the above sequence occurs in
v1.1.1 the two renderings of the SVG occur at the same scale (say 1.25 times
the original). However when this is executed in v1.5 the SVG is first rendered
at a scale of 1.25 then at a scale of (1.25 * 1.25). The objects and the SVG
are therefore being rendered at different scales (1.25 and 1.25^2)
respectively. This can be further shown by setting the scale to 1 which allows
the objects and the SVG to be rendered at the same scale since 1^2=1. Our ideal solution would be to prevent the re-rendering of
the SVG (which we presume is being triggered by the rendering of the objects on
top of it). However if we should be drawing the objects using some other
mechanism we would like to know how to do this. I looked through the archives
of this group and I get the impression that I should be rendering all the
objects using some form of overlay object. However the objects have context
menus and the user can interact with them to move them and resize them so I
would need to be able to provide this type of functionality using the
alternative object rendering solution if one is suggested. I've tried some of the methods on JSVGCanvas
that would appear to disable it/enable it around the calls to scale the objects
but the above sequence still appear to occur. Thanks in advance, Rob ------------------------------------------------------------------- Rob Wilkins, Tandberg Television, Control &
Management Software, Strategic Park, Tel: (023) 8057 3116 (Int. Ex 3116) Fax:
(023) 8057 3341 E-Mail: [EMAIL PROTECTED] *********************************************************************************** This email, its content and any attachments is PRIVATE AND CONFIDENTIAL to TANDBERG Television. If received in error please notify the sender and destroy the original message and attachments. www.tandbergtv.com *********************************************************************************** |
- Re: Displaying Java objects on top of JSVGCanvas objects Wilkins, Rob
- Re: Displaying Java objects on top of JSVGCanvas objec... Thomas DeWeese
- RE: Displaying Java objects on top of JSVGCanvas objec... Wilkins, Rob
- Re: Displaying Java objects on top of JSVGCanvas o... Thomas DeWeese
- RE: Displaying Java objects on top of JSVGCanvas objec... Wilkins, Rob
- Re: Displaying Java objects on top of JSVGCanvas o... Thomas DeWeese
- RE: Displaying Java objects on top of JSVGCanvas objec... Wilkins, Rob
- Re: Displaying Java objects on top of JSVGCanvas o... Thomas DeWeese
- RE: Displaying Java objects on top of JSVGCanvas objec... Wilkins, Rob
- Re: Displaying Java objects on top of JSVGCanvas o... Thomas DeWeese
- RE: Displaying Java objects on top of JSVGCanvas o... Tonny Kohar