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 de...@apache.org on 2002/11/13 21:20:55 UTC

cvs commit: xml-batik/sources/org/apache/batik/swing/svg JSVGComponent.java

deweese     2002/11/13 12:20:55

  Modified:    sources/org/apache/batik/ext/awt/image/spi
                        JPEGRegistryEntry.java
               sources/org/apache/batik/gvt/renderer
                        StrokingTextPainter.java
               sources/org/apache/batik/swing/svg JSVGComponent.java
  Log:
  1) The JPEG decoder now returns what it was able to decode from partial
     JPEG files.
  2) The JSVGComponent should no longer throw a noninvertable exception
     when it's size isn't set.
  
  Revision  Changes    Path
  1.8       +11 -1     xml-batik/sources/org/apache/batik/ext/awt/image/spi/JPEGRegistryEntry.java
  
  Index: JPEGRegistryEntry.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/spi/JPEGRegistryEntry.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JPEGRegistryEntry.java	25 Sep 2001 21:04:34 -0000	1.7
  +++ JPEGRegistryEntry.java	13 Nov 2002 20:20:47 -0000	1.8
  @@ -10,6 +10,7 @@
   
   import com.sun.image.codec.jpeg.JPEGImageDecoder;
   import com.sun.image.codec.jpeg.JPEGCodec;
  +import com.sun.image.codec.jpeg.TruncatedFileException;
   
   import java.io.InputStream;
   import java.io.IOException;
  @@ -70,7 +71,16 @@
                           JPEGImageDecoder decoder;
                           decoder = JPEGCodec.createJPEGDecoder(is);
                           BufferedImage image;
  -                        image   = decoder.decodeAsBufferedImage();
  +                        try { 
  +                            image   = decoder.decodeAsBufferedImage();
  +                        } catch (TruncatedFileException tfe) {
  +                            image = tfe.getBufferedImage();
  +                            // Should probably draw some indication
  +                            // that this is a partial image....
  +                            if (image == null)
  +                                throw new IOException
  +                                    ("JPEG File was truncated");
  +                        }
                           CachableRed cr;
                           cr = GraphicsUtil.wrap(image);
                           cr = new Any2sRGBRed(cr);
  
  
  
  1.41      +4 -2      xml-batik/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java
  
  Index: StrokingTextPainter.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/renderer/StrokingTextPainter.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- StrokingTextPainter.java	6 Nov 2002 20:55:46 -0000	1.40
  +++ StrokingTextPainter.java	13 Nov 2002 20:20:47 -0000	1.41
  @@ -807,7 +807,9 @@
               tpShiftY  = 0;
           }
   
  -        // System.out.println("ABS: [" + absX + "," + absY + "]");
  +        // System.out.println("ABS: [" + absX + "," + absY + "," + 
  +        //                    visualAdvance.getX() + "," + 
  +        //                    visualAdvance.getY() + "]");
           for (int n=chunk.begin; n<chunk.end; ++n) {
               r = (TextRun) textRuns.get(n);
               layout = r.getLayout();
  
  
  
  1.60      +3 -1      xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
  
  Index: JSVGComponent.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- JSVGComponent.java	5 Sep 2002 12:58:19 -0000	1.59
  +++ JSVGComponent.java	13 Nov 2002 20:20:51 -0000	1.60
  @@ -601,6 +601,8 @@
               if (svgDocument != null) {
                   SVGSVGElement elt = svgDocument.getRootElement();
                   Dimension d = getSize();
  +                if (d.width  < 1) d.width  = 1;
  +                if (d.height < 1) d.height = 1;
                   setRenderingTransform
                       (ViewBox.getViewTransform
                        (fragmentIdentifier, elt, d.width, d.height));
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org