xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From George Armhold <armh...@cs.rutgers.edu>
Subject Re: setAttribute vs setAttributeNS
Date Wed, 10 Dec 2003 23:23:25 GMT
Thomas DeWeese wrote:

> It is possible that we do not calculate the effected bounds of
> the change to the document when the filter effect is added (although
> in my testing this has worked).  I'll try and take a look.

Well I hacked it down, and now my "short" example program is over 200
lines.  I hope this won't be too painful for you.  The program
dynamically creates a document that looks like the following:

<svg>
   <defs>
      <filter xmlns:xlink="http://www.w3.org/1999/xlink"
              filterUnits="objectBoundingBox"
              xlink:type="simple"
              xlink:actuate="onRequest"
              id="filter-bgGroup"
              xlink:show="replace">
         <feImage result="background"
                  xmlns:xlink="http://www.w3.org/1999/xlink"
                  xlink:href="#bgGroup"
                  xlink:type="simple"
                  xlink:actuate="onRequest"
                  xlink:show="replace"/>
         <feComposite operator="in" in2="SourceGraphic" in="background"/>
      </filter>
  </defs>

<g style="stroke:black; stroke-opacity:1; stroke-linejoin:round; 
stroke-linecap:round; fill:black; stroke-width: 20px; " id="bgGroup">

     <image x="0" y="0"
            width="100%" height="100%"
            xmlns:xlink="http://www.w3.org/1999/xlink"
 
xlink:href="http://erudycja.rutgers.edu/~armhold/svg/eiffel.jpg"
            xlink:type="simple"
            xlink:actuate="onRequest"
            preserveAspectRatio="xMidYMid meet"
            xlink:show="replace"/>
</g>

<rect x="10%" y="20%"
       width="80%" height="60%"
       fill="white"/>

<g style="stroke:black; stroke-opacity:1; stroke-linejoin:round; 
stroke-linecap:round; fill:black; stroke-width: 20px; filter: 
url(#filter-bgGroup);" id="drawing_group">

</g>

</svg>


First, it displays an image from a .jpg file.  Then it draws a white
rectangle which partially obscures the image.  Then the user can
"erase" parts of this rectangle by drawing with the left mouse button,
to reveal the image again.  You'll see that the drawing doesn't seem
to update properly.  If you then click the right mouse button, the doc
will get re-loaded, and the drawing thus becomes visible.

I hope this will be useful.  Thanks as always for looking into this.


-- 
George Armhold
Rutgers University
eLearning Grant, DCIS

Mime
View raw message