xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eddie <Edwin.Litte...@fiz-karlsruhe.de>
Subject Transparency problem
Date Thu, 21 Aug 2014 15:37:22 GMT

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.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.fillRect((int) textBounds.getX(), (int)
textBounds.getY(), (int) textBounds.getWidth(),
            (int) textBounds.getHeight());

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"


  <defs id="defs1"
    ><filter width="100%" x="0%" height="100%" y="0%" id="alphaCompositeSrc"
      ><feFlood style="flood-color:white; flood-opacity:1;" result="flood"
        /><feComposite k2="1" in2="BackgroundImage" operator="arithmetic"
result="composite" in="SourceGraphic"
        ><feMergeNode in="flood"
          /><feMergeNode in="composite"

Unfortunately I don't understand of svg and CSS to see what's wrong here.


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: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

View raw message