Hi,
I wrote some code which is using transparency. The background of the image
should be transparent (background color is Color(255,255,255,0)):
graphics2D.setColor(BACKGROUND_COLOR);
graphics2D.fillRect(0, 0, imageWidth, imageHeight);
When I am drawing something to the image and then need to overwrite part of
it with the default background this works as long as I generate an image in
PNG format.
graphics2D.setComposite(AlphaComposite.Src);
graphics2D.setColor(BACKGROUND_COLOR);
graphics2D.fillRect((int) textBounds.getX(), (int)
textBounds.getY(), (int) textBounds.getWidth(),
(int) textBounds.getHeight());
graphics2D.setComposite(savedComposite);
When I generate an svg image from the same code the background is not reset
to background color. Instead everything which was already drawn in this area
is still visible.
Am I doing something wrong, is this a problem of the browser (I tested with
FF, IE and chrome) or is this not possible?
This is the part of the svg clearing the rectangle:
<g style="fill:rgb(255,255,255); stroke-width:2; fill-opacity:0;
font-size:16.8px; stroke-opacity:0; stroke:rgb(255,255,255);"
><rect x="745" y="18" width="33" style="filter:url(#alphaCompositeSrc);
stroke:none;" height="16"
alphaComposite:
<defs id="defs1"
><filter width="100%" x="0%" height="100%" y="0%" id="alphaCompositeSrc"
filterUnits="objectBoundingBox"
><feFlood style="flood-color:white; flood-opacity:1;" result="flood"
/><feComposite k2="1" in2="BackgroundImage" operator="arithmetic"
result="composite" in="SourceGraphic"
/><feMerge
><feMergeNode in="flood"
/><feMergeNode in="composite"
/></feMerge
></filter
></defs
Unfortunately I don't understand of svg and CSS to see what's wrong here.
Regards,
Eddie
--
View this message in context:
http://batik.2283329.n4.nabble.com/Transparency-problem-tp4656158.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]