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 Sylvain Caillet <s....@free.fr> on 2005/12/01 12:23:17 UTC
XOR Mode to repaint SVG object
Hi to all !
I have a Java panel on which i have to allow my users to move a SVG object rendered with the Batik API. I'm looking for a way to use the XOR technic to efficiently paint/remove my object during the move.
I currently a code like that to paint the SVG :
---------------- begin code --------------
public void paint(Graphics g) {
// GraphicsNode gn;
Graphics2D g2d;
g2d = (Graphics2D)g.create(x,y,width,height);
g2d.scale(sx, sy);
gn.paint(g2d);
}
---------------- end code --------------
Is it possible to use (on g or g2d ?) the setXORMode method ?
Thank you for your help
Best regards
Sylvain Caillet
Re: XOR Mode to repaint SVG object
Posted by th...@kodak.com.
Hi Sylvain,
"Sylvain Caillet" <s....@free.fr> wrote on 12/01/2005 06:23:17 AM:
> I have a Java panel on which i have to allow my users to move a SVG
object
> rendered with the Batik API. I'm looking for a way to use the XOR
technic to
> efficiently paint/remove my object during the move.
You can't really use XOR for SVG content since it uses alpha
compositing.
I would suggest rendering the SVG content to a BufferedImage with alpha
and
then just move the buffered image version. This will be plenty fast...
and look a lot better ;).
>
> I currently a code like that to paint the SVG :
> ---------------- begin code --------------
> public void paint(Graphics g) {
> // GraphicsNode gn;
> Graphics2D g2d;
>
> g2d = (Graphics2D)g.create(x,y,width,height);
> g2d.scale(sx, sy);
> gn.paint(g2d);
> }
> ---------------- end code --------------
> Is it possible to use (on g or g2d ?) the setXORMode method ?
>
> Thank you for your help
>
> Best regards
>
> Sylvain Caillet
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org