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 2001/09/25 23:04:34 UTC

cvs commit: xml-batik/sources/org/apache/batik/ext/awt/image/spi JPEGRegistryEntry.java

deweese     01/09/25 14:04:34

  Modified:    sources/org/apache/batik/bridge SVGImageElementBridge.java
               sources/org/apache/batik/ext/awt/image/spi
                        JPEGRegistryEntry.java
  Log:
  1) Checks that SVG_BROKEN_LINK_DOCUMENT property is in fact an SVGDocument.
  2) Does the conversion to sRGB once up-front.
  
  Revision  Changes    Path
  1.28      +4 -4      xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java
  
  Index: SVGImageElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- SVGImageElementBridge.java	2001/09/18 21:18:59	1.27
  +++ SVGImageElementBridge.java	2001/09/25 21:04:34	1.28
  @@ -45,7 +45,7 @@
    * Bridge class for the <image> element.
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
  - * @version $Id: SVGImageElementBridge.java,v 1.27 2001/09/18 21:18:59 deweese Exp $
  + * @version $Id: SVGImageElementBridge.java,v 1.28 2001/09/25 21:04:34 deweese Exp $
    */
   public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
   
  @@ -164,11 +164,11 @@
   
           ImageTagRegistry reg = ImageTagRegistry.getRegistry();
           Filter           img = reg.readURL(purl, extractColorSpace(e, ctx));
  -        SVGDocument errDoc = (SVGDocument)img.getProperty
  +        Object           obj = img.getProperty
               (SVGBrokenLinkProvider.SVG_BROKEN_LINK_DOCUMENT_PROPERTY);
  -        if (errDoc != null) {
  +        if ((obj != null) && (obj instanceof SVGDocument)) {
               // Ok so we are dealing with a broken link.
  -            return createSVGImageNode(ctx, e, errDoc);
  +            return createSVGImageNode(ctx, e, (SVGDocument)obj);
           }
           node.setImage(img);
   	Rectangle2D imgBounds = img.getBounds2D();
  
  
  
  1.7       +7 -0      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JPEGRegistryEntry.java	2001/08/07 17:28:22	1.6
  +++ JPEGRegistryEntry.java	2001/09/25 21:04:34	1.7
  @@ -14,6 +14,8 @@
   import java.io.InputStream;
   import java.io.IOException;
   import java.awt.image.BufferedImage;
  +import java.awt.image.WritableRaster;
  +import java.awt.image.ColorModel;
   
   import org.apache.batik.ext.awt.image.GraphicsUtil;
   import org.apache.batik.ext.awt.image.renderable.Filter;
  @@ -72,6 +74,11 @@
                           CachableRed cr;
                           cr = GraphicsUtil.wrap(image);
                           cr = new Any2sRGBRed(cr);
  +                        WritableRaster wr = (WritableRaster)cr.getData();
  +                        ColorModel cm = cr.getColorModel();
  +                        image = new BufferedImage
  +                            (cm, wr, cm.isAlphaPremultiplied(), null);
  +                        cr = GraphicsUtil.wrap(image);
                           filt = new RedRable(cr);
                       } catch (IOException ioe) {
                           // Something bad happened here...
  
  
  

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