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 Edison Too <ed...@yahoo.com.sg> on 2001/07/11 15:12:28 UTC
GVT problem with GaussianBlur
Hi,
I understand that this question is related to GVT (part of Batik) and not
Batik/SVG directly. If someone can help me with GVT privately, I'd
thankfully refrain from sending GVT questions to the list. Sorry if this
causes inconvenience to you as a list user.
I'm trying to draw a gaussian blurred rectangle on to the Graphics passed in
via the paintComponent(g) call of JComponent. To do this, I call the
paint(g2d,rc) method of a CanvasGraphicsNode I've already set up. This has
only one node set-up as below.
GraphicsNode aNode = GVTSupport.createShapeNode(new
Rectangle(50,150,100,60),Color.red,null,null);
GraphicsNodeRenderContext rc = GVTSupport.getRenderContext();
Filter aFilter =
GVTSupport.getGNRFactory().createGraphicsNodeRable(aNode,rc);
aFilter = new GaussianBlurRable8Bit(aFilter,2.0f,2.0F);
aNode.setFilter(aFilter);
rootGN.add(aNode);
GVTSupport is a convenience class with which I construct the node.
The problem is that though the Rectangle is drawn, the gaussian blur didn't
work the way I expected. I can see that the blurring was carried out,but the
pixels were still either red (the fill color) or white (the background
color). Instead of a blurred edge with color changing from red to white, I
see a distinct edge. I can tell that blurring has occurred because, the
resultant rectangle has rounded corners and is larger than the original
rectangle.
I suspect it is some kind of color space issue, but I couldn't figure out
what I did wrong. If anyone could see it, please let me know. Thanks in
advance. :)
Cheers,
Edison
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
RE: GVT problem with GaussianBlur
Posted by Edison Too <ed...@yahoo.com.sg>.
Hi, Thomas
Thanks for the help, I just figured this out too. The problem went away when
I use a BufferedImage. I guess, I'll just have to create an off-screen
buffer. :)
Best regards,
Edison
> -----Original Message-----
> From: Thomas E Deweese [mailto:thomas.deweese@kodak.com]
> ET> I suspect it is some kind of color space issue, but I couldn't
> ET> figure out what I did wrong. If anyone could see it, please let me
> ET> know. Thanks in advance. :)
>
> Well, I don't know that this is a huge help, but I suspect your
> 'color space issue' is in fact a problem with the alpha channel.
> There are a number destination image types that don't handle alpha
> correctly in the JDK, we generally work around these by drawing to an
> image type we know works.
>
> So I would suggest trying to have your Graphics node drawn to a
> BufferedImage.TYPE_INT_ARGB, then draw that to the given graphics.
>
> I hope this helps!
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
GVT problem with GaussianBlur
Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "ET" == Edison Too <ed...@yahoo.com.sg> writes:
ET> The problem is that though the Rectangle is drawn, the gaussian
ET> blur didn't work the way I expected. I can see that the blurring
ET> was carried out,but the pixels were still either red (the fill
ET> color) or white (the background color). Instead of a blurred edge
ET> with color changing from red to white, I see a distinct edge. I
ET> can tell that blurring has occurred because, the resultant
ET> rectangle has rounded corners and is larger than the original
ET> rectangle.
ET> I suspect it is some kind of color space issue, but I couldn't
ET> figure out what I did wrong. If anyone could see it, please let me
ET> know. Thanks in advance. :)
Well, I don't know that this is a huge help, but I suspect your
'color space issue' is in fact a problem with the alpha channel.
There are a number destination image types that don't handle alpha
correctly in the JDK, we generally work around these by drawing to an
image type we know works.
So I would suggest trying to have your Graphics node drawn to a
BufferedImage.TYPE_INT_ARGB, then draw that to the given graphics.
I hope this helps!
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org