Stephan M�ller wrote:
I want to paint a SVG directly on a Graphics2D, without creating first a BufferedImage.
Therefore I used the GraphicsNodes paint()-method. But it doesn't work with SVGs using
filter - the result looks ugly. Using the StaticRenderer instead works fine, but
I don't want to use that. Why doesn't it work?
Tonny Kohar wrote:
If the result look ugly maybe you need to set the anti-alias on, but I
could be wrong
Hi Guys,
The problem is that the component doesn't have an alpha channel.
So when the filters try to match it the result is pretty ugly. I have
attached a tentative patch for the problem. I'm wary about putting it
in CVS because this stuff evolved out of a lot of trial an error, so
any change is really risking breaking stuff that already works...
I want to at least have a chance to check printing before I
commit the change.
Index: sources/org/apache/batik/ext/awt/image/GraphicsUtil.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/GraphicsUtil.java,v
retrieving revision 1.32
diff -w -u -r1.32 GraphicsUtil.java
--- sources/org/apache/batik/ext/awt/image/GraphicsUtil.java 18 Aug 2004 07:13:48
-0000 1.32
+++ sources/org/apache/batik/ext/awt/image/GraphicsUtil.java 22 Aug 2004 01:16:13
-0000
@@ -134,15 +134,11 @@
// Assume device is sRGB
g2dCS = ColorSpace.getInstance(ColorSpace.CS_sRGB);
ColorModel drawCM = g2dCM;
- if (g2dCM == null) {
- // If we can't find out about our device assume
- // it's SRGB unpremultiplied (Just because this
- // seems to work for us).
+ if ((g2dCM == null) || !g2dCM.hasAlpha()) {
+ // If we can't find out about our device or the device
+ // does not support alpha just use SRGB unpremultiplied
+ // (Just because this seems to work for us).
drawCM = sRGB_Unpre;
- } else if (drawCM.hasAlpha() && g2dCM.hasAlpha() &&
- (drawCM.isAlphaPremultiplied() !=
- g2dCM .isAlphaPremultiplied())) {
- drawCM = coerceColorModel(drawCM, g2dCM.isAlphaPremultiplied());
}
if (cr instanceof BufferedImageCachableRed) {
@@ -281,8 +277,9 @@
Rectangle iR = new Rectangle(0,0,0,0);
if (false) {
- System.out.println("CR: " + cr);
- System.out.println("CRR: " + crR + " TG: [" +
+ System.err.println("SrcCM: " + srcCM);
+ System.err.println("CR: " + cr);
+ System.err.println("CRR: " + crR + " TG: [" +
xt0 +"," +
yt0 +"," +
xt1 +"," +
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]