You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Carsten Birn <Ca...@rose.de> on 2004/09/23 14:05:48 UTC
Graphics2D Context changes
Hi
I have experienced when you set a Graphics2D in the GraphicsNode paint method, the internal settings e.g color (setColor) changes to the last used color from the SVG document.
Can this be understood as an error?
I would suggest that the Graphics2D keeps unchanged, otherwise some strange effects might happend.
The problem is, that i am using using the GVT to paint SVG into a JPanel along with Graphics2D objects.
Carsten Birn
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Graphics2D Context changes
Posted by Thomas DeWeese <Th...@Kodak.com>.
Carsten Birn wrote:
> I have experienced when you set a Graphics2D in the GraphicsNode
> paint method, the internal settings e.g color (setColor) changes
> to the last used color from the SVG document.
>
> Can this be understood as an error?
I would consider it a "feature". It would be expensive to ensure
that if you call paint on a GraphicsNode the Graphics2D is unchanged.
We actually currently do significantly more setting/resetting than
I would like, supporting this would only make this worse.
> I would suggest that the Graphics2D keeps unchanged, otherwise some
> strange effects might happend. The problem is, that i am using using
> the GVT to paint SVG into a JPanel along with Graphics2D objects.
I would suggest that when you pass a mutable object into someone
else's function, unless given assurances, you should assume that
it is changed. After all do you take care to restore the Graphics2D
state before you return from JPanel.paint? Most people don't.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org