Hi -
I've figured out the problem but I'm not entirely sure how to fix it. I do have a hack in place right now that solves the problem, but it's not at all efficiant so I'd like to change it.
The problem seems to be caused by the size of the document. When I create a new canvas, I create the SVGDocument with the following code:
public static SVGDocument createNewSVGDocument() {
DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
Document document = impl.createDocument(SVGDOMImplementation.SVG_NAMESPACE_URI, SVG_SVG_TAG, null);
return (SVGDocument)document;
}
When I add SVG tags to that document and drag them around, the repainting problem does not occur in the top left portion of the screen. The bounds seems to be about 200x200 or so. As soon as I start dragging objects outside of that rectangle, I get repaint problems.
I tried resetting the width, height, and viewport variables and had no luck. I'd love to solve this because my current solution is not at all efficiant.
Thanks,
Mike Braude
-----Original Message-----
From: Thomas E Deweese [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 19, 2002 10:31 AM
To: Batik Users
Subject: Please help with repaint problem..
>>>>> "B" == BraudeM <[EMAIL PROTECTED]> writes:
B> I sent a mail out before but only got one response. Somebody's got
B> to know what's going on here....I really need some help.
You never responded to my response which had four or five requests
for more information. In particular a small screen shot of the dirty
stuff would be useful to see (can email directly if you can't get size
down).
B> I'm building an SVG WYSIWYG editor using batik 1.5 with the jdk
B> 1.3.
Which Batik 1.5? Beta 1, 2, or 3?
If it's not '3' please upgrade.
B> The user drags SVG shapes onto an SVGCanvas, and can drag, rotate,
B> and scale the shapes. The code's pretty simple -
B> if(selectionManager.isSelected(controlNode))
B> selectionManager.positionSelectionBox(controlNode);
This is interesting. How does the selectionManager draw it's
selection box?
B> public static void setTransform(Element controlNode,
B> AffineTransform transform) {
[...]
B> controlNode.setAttributeNS(null, SVG_TRANSFORM_ATTRIBUTE,
B> matrixTransform);
Just as an FYI, I do this all the time through ECMA script. So
there is something else that is effecting behaviour. One thing just
occured to me, does this stuff have filters? We don't properly
account for filters in our bounds calculations right now.
B> This is the code that gets called when I want to move a shape
B> around on the canvas...it works, but it seems to me that there's an
B> error with the dirty rect caclulations, because when the canvas
B> gets repainted, I see little splotches of the shapes all around the
B> canvas. I don't know what's going on. The problem only occurs
B> when repaint is called.
Sure, but repaint being called is very common, as it happens when
ever another window damages part of the Java window, or when the
window is resized. Even when you pan in the Canvas it is redrawing
the entire offscreen buffer. None of these cause the dirty bits to be
displayed in straight Squiggle.
Are you using Double Buffered rendering or single buffered (if you
don't do anything, by default JSVGCanvas has double buffering off).
B> Somebody suggested that perhaps its a size issue, but I am setting
B> the dimension of the SVG to be more than large enough. While
B> debugging, I've proven that it's the renderer.getOffScreen() that's
B> causing the problem. This is the image that's all jumbled
B> up....before repaint is called, I'm assuming the rendering system
B> is only updating the part of the screen that's been changed..but
B> the underlying buffer is not repainted properly.
If you are using single buffer it generally is not a good idea to
just call renderer.getOffScreen() as you are likely to get the buffer
in the middle of a rendering request (which will have some dirty bits
in it although they should only one frames worth of dirty bits, you
seem to be describing more than that).
B> Please, I'd appreciate any suggestions or help anybody can offer
B> me. I've spent a significant amount of time trying to fix this and
B> haven't made any progress.
As I pointed out in my other message most of what you have
described is done all the time without the side effects you have. So
to help you we need to know more about your code. In particular I'd
be curious to know more about your selectionManager. Does it plug
into Batik's overlay framework? Is it another SVG element that is
moved around (if so how? are filters involved?)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Andover Controls Corporation and or Andover Controls LTD. which may be confidential, proprietary, copyrighted and/or legally privileged. This Email is intended solely for the use of the individual or entity named on the message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.
==============================================================================
