You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Thierry Kormann <Th...@sophia.inria.fr> on 2000/10/26 14:41:34 UTC

new features and bugs

*** intermediate up to date ***

- Bug fix in StrokingTextPainter. We now first do fill and then do stroke.

- The thumbnail view is now smaller

- SVGMaskElementBridge

 * The code is now cleaner. We get the GVTBuilder from the BridgeContext and we 
use it to create the mask content.
 * The 'tranform' attribute on the mask element is now applied to the 
CompositeGraphicsNode that contains the mask element children. ie. We should 
now consider the 'transform' attribute specified on mask
 *  Due to a comment, I set a clipping area on the CompositeGraphicsNode (the 
one that contains the mask children) to the filterRegion.getRegion().


--------

Things we need to fix :

- samples/tests/opacity.svg do not work anymore with pan
- coords-viewBox-BE-03.svg
- masking-vportClip-BE-09.svg

It seems that it's clip problem. I will try to fix that.

Note: we don't pass the mask BE test. Any idea (Vincent, Thomas) ?

Thomas, I think you can send us your source code for the image element.
Do you now have an up to date version of the CVS tree ? If not I will send it 
to you.

Any comments?
Thierry.

-- 
Thierry Kormann
email: Thierry.Kormann@sophia.inria.fr  http://www.inria.fr/koala/tkormann/
Koala/Dyade/Bull @ INRIA - Sophia Antipolis






Re: new features and bugs

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "TK" == Thierry Kormann <Th...@sophia.inria.fr> writes:

TK> OK, sorry for the delay.  

    No problem I was working on relative URLs, and caching/sharing
image data (both working now).

TK> The current version of the CVS repository is located at :
TK> ftp://koala.inria.fr/batik/

TK> Please send me an email when you have downloaded the archive, I
TK> will remove it.

    Thanks, I've downloaded it, you may remove it now.

new features and bugs

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "TK" == Thierry Kormann <Th...@sophia.inria.fr> writes:

TK> Thomas, I think you can send us your source code for the image
TK> element.  Do you now have an up to date version of the CVS tree ?
TK> If not I will send it to you.

    No I don't have an up to date version of the CVS tree. I wanted to
integrate into that before sending out my changes.  So please do
either send a copy or put it up for FTP...

    I may have some leads on the clipping problem (not updating the
aoi when changing the transform on the RC).

Re: Image

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "TK" == Thierry Kormann <Th...@sophia.inria.fr> writes:

TD>  Ok I can reproduce this, I'll try to resolve the issue.

TK> So, I have tried to find that and it's the aoi which seems to be
TK> wrong.  If you put in ConcreteRasterImageNode [...]

TK> it works better :)

The following patch solves the problem 
(so much for trying to fix the aoi myself).

---

diff -rwu xml-batik/sources/org/apache/batik/refimpl/gvt/ConcreteRasterImageNode.java /home/deweese/batik/xml-batik/sources/org/apache/batik/refimpl/gvt/ConcreteRasterImageNode.java
--- xml-batik/sources/org/apache/batik/refimpl/gvt/ConcreteRasterImageNode.javaThu Oct 26 13:46:36 2000
+++ /home/deweese/batik/xml-batik/sources/org/apache/batik/refimpl/gvt/ConcreteRasterImageNode.java     Thu Oct 26 15:56:17 2000
@@ -84,7 +84,9 @@
     }
 
     public void primitivePaint(Graphics2D g2d, GraphicsNodeRenderContext rc) {
-        if (image == null) {
+        if ((image == null)||
+            (bounds.getWidth()  == 0) ||
+            (bounds.getHeight() == 0)) {
             return;
         }
 
@@ -92,8 +94,8 @@
         AffineTransform origAt = g2d.getTransform();
         AffineTransform at     = (AffineTransform)origAt.clone();
         
-        float tx0 = -image.getMinX();
-        float ty0 = -image.getMinY();
+        float tx0 = image.getMinX();
+        float ty0 = image.getMinY();
 
         float sx  = (float)(bounds.getWidth() /image.getWidth());
         float sy  = (float)(bounds.getHeight()/image.getHeight());
@@ -105,17 +107,17 @@
         // the device coord system, including scaling to our bounds.
         at.concatenate(AffineTransform.getTranslateInstance(tx1, ty1));
         at.concatenate(AffineTransform.getScaleInstance    (sx, sy));
-        at.concatenate(AffineTransform.getTranslateInstance(tx0, ty0));
+        at.concatenate(AffineTransform.getTranslateInstance(-tx0, -ty0));
+
+        AffineTransform usr2src = new AffineTransform();
+        usr2src.concatenate(AffineTransform.getTranslateInstance(tx0, ty0));
+        usr2src.concatenate(AffineTransform.getScaleInstance    (1/sx, 1/sy));
+        usr2src.concatenate(AffineTransform.getTranslateInstance(-tx1, -ty1));
 
         Shape aoi = g2d.getClip();
         if(aoi == null) aoi = getBounds();
 
-        // Map it back to our images coord system.
-        Rectangle2D newAOI = aoi.getBounds2D();
-        newAOI = new Rectangle2D.Float((float)(newAOI.getMinX()+tx0-tx1),
-                                       (float)(newAOI.getMinY()+ty0-ty1),
-                                       (float)(newAOI.getWidth()/sx),
-                                       (float)(newAOI.getHeight()/sy));
+        Shape newAOI = usr2src.createTransformedShape(aoi);
 
         rc.setTransform(at);
         rc.setAreaOfInterest(newAOI);

Re: Image

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "TK" == Thierry Kormann <Th...@sophia.inria.fr> writes:

TK> Could send me an email when downloaded.

    Thanks, you can delete this.

TK> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN" [...]
>>  This works fine for me with the AffineRed fix...

TK> Argh, ok no more grey lines but try to do an aoi in the following
TK> document on the botton of the image and then PAN to the bottom,
TK> some part of the image are not displayed ...

    Ok I can reproduce this, I'll try to resolve the issue.

TK> By the way, where do you clean your image cache ???  Do we have a
TK> memory leak ???

    Not in the way you think.  I use SoftReferences in the cache.  So
there is a slight memory "leak" in that urls can build up (with empty
associated SoftReferences), but the Images will get flushed shortly
after the last hard (normal) reference to them is cleared.

    I suppose I could add a very low priority 'cleanup' (long
sleeping) thread, or every N images, traverse the cache looking for
URL's who's images had been flushed (this would handle any risk of
leaking memory).  Is this worth doing?

Image

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "TK" == Thierry Kormann <Th...@sophia.inria.fr> writes:

TK> 1/ The bind method is only for dynamic stuffs.  The line in the
TK> SVGShapeElementBridge was used by the part of christophe
TK> (animation) so we really need to keep that line

    Ok, sorry.

TK> 2/ The things we changed in the bridge :

TK> PS : a mask in SVG is defined using the <mask> element (see
TK> samples/tests/mask.svg) for more. That's why I have integrated
TK> your code but I was not able to see the logoSVGImg.svg example
TK> (except with your code and I don't know why ?).

    The <mask> element is why, my example references a <g> node.  From
my first reading of the spec it wasn't clear that a mask element was
needed. This means my changes in the CSSUtilities are wrong, please
ignore them...

TK> Next time, could you please just send me the files you changed.
TK> It's gonna be easier for me.

    Ok, last time Stephane wanted the whole tree.  Just the modified
stuff is my preference.

TK> Another thing is that I am not able to display that document
TK> correctly (a grey line appears after a transform).

    Did you incorperate my fix to AffineRed?  It's a slight
modification (3 lines or so).  

TK> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN" [...]

    This works fine for me with the AffineRed fix...


new features and bugs

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "TK" == Thierry Kormann <Th...@sophia.inria.fr> writes:

TK> Things we need to fix :

TK> Note: we don't pass the mask BE test. Any idea (Vincent, Thomas) ?

    Hmm, well it looks like the changes to the CSSUtilities.convertMask
are broken.

    In particular there is no such thing as a "Mask Element" (it's an
attribute) so the MaskElement is any SVGElement.  
thus the following doesn't work.

---

         MaskBridge maskBridge = (MaskBridge)ctx.getBridge(maskElement);
			         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
				 // This returns a SVGGElementBridge since
				 // that is what the maskElement is.

         // No bridge understands the mask element...
         if(maskBridge == null){
             return null;
         }

         return maskBridge.createMask(gn, ctx,
                                      maskElement, 
                                      maskedElement);
---

   This is why my code originally didn't look like the filter code.
I've temporarily fixed this by explicitly constructing an
SVGMaskElementBridge every time :(. See comments in the code for
possible ways to fix this.

   You also seem to have dropped some of the bind calls. The call to
'bind' is gone from SVGGElementBridge, but not from
SVGShapeElementBridge. I've removed the call to bind from both.

    My image stuff is working great so even though Masking still has
some problems (although better then when I got it).  I've zipped my
integrated workspaces and put it on ftp://koala.inria.fr/incoming.
I'm going to lunch (then the concall).

   I suspect that my perceived masking problem relates to the fact
that the newly built masking GVT tree doesn't pick up the full tree's
scaling/translation information.  I guess I'm not sure if it should or
not.

   Not that there are two new files in the sample directory.

   9.gif (a bunch of colored rects )
   logoShadowImg.svg  (a file that butchers the batik logo with
                       lots of ugly image refs).