icedtea

changeset 362:2989dbf0b643

2007-11-16 Lillian Angel <langel@redhat.com>

* AUTHORS: Added Mathhew Flaschen.

2007-11-16 Matthew Flaschen <matthew.flaschen@gatech.edu>

* rt/com/sun/image/codec/jpeg/JPEGCodec.java: Partially implemented.
* rt/com/sun/image/codec/jpeg/JPEGImageDecoder.java: Implemented.
* rt/com/sun/image/codec/jpeg/ImageFormatException.java: New Class,
implemented.
* rt/com/sun/image/codec/jpeg/JPEGDecodeParam.java: New Class,
stubbed.
author Lillian Angel <langel@redhat.com>
date Fri Nov 16 09:19:22 2007 -0500 (2007-11-16)
parents 1f7f39188e9f
children a728abeb98e8
files AUTHORS ChangeLog rt/com/sun/image/codec/jpeg/ImageFormatException.java rt/com/sun/image/codec/jpeg/JPEGCodec.java rt/com/sun/image/codec/jpeg/JPEGDecodeParam.java rt/com/sun/image/codec/jpeg/JPEGImageDecoder.java
line diff
     1.1 --- a/AUTHORS	Fri Nov 16 13:18:29 2007 +0000
     1.2 +++ b/AUTHORS	Fri Nov 16 09:19:22 2007 -0500
     1.3 @@ -5,6 +5,7 @@
     1.4  Gary Benson <gbenson@redhat.com>
     1.5  Tania Bento <tbento@redhat.com>
     1.6  Thomas Fitzsimmons <fitzsim@redhat.com>
     1.7 +Matthew Flaschen <matthew.flaschen@gatech.edu>
     1.8  Kyle Galloway <kgallowa@redhat.com>
     1.9  Andrew Haley <aph@redhat.com>
    1.10  Matthias Klose <doko@ubuntu.com>
     2.1 --- a/ChangeLog	Fri Nov 16 13:18:29 2007 +0000
     2.2 +++ b/ChangeLog	Fri Nov 16 09:19:22 2007 -0500
     2.3 @@ -1,3 +1,16 @@
     2.4 +2007-11-16  Lillian Angel  <langel@redhat.com>
     2.5 +
     2.6 +	* AUTHORS: Added Mathhew Flaschen.
     2.7 +
     2.8 +2007-11-16  Matthew Flaschen  <matthew.flaschen@gatech.edu>
     2.9 +
    2.10 +	* rt/com/sun/image/codec/jpeg/JPEGCodec.java: Partially implemented.
    2.11 +	* rt/com/sun/image/codec/jpeg/JPEGImageDecoder.java: Implemented.
    2.12 +	* rt/com/sun/image/codec/jpeg/ImageFormatException.java: New Class,
    2.13 +	implemented.
    2.14 +	* rt/com/sun/image/codec/jpeg/JPEGDecodeParam.java: New Class,
    2.15 +	stubbed.
    2.16 +
    2.17  2007-11-16  Gary Benson  <gbenson@redhat.com>
    2.18  
    2.19  	* contrib: New directory.
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/rt/com/sun/image/codec/jpeg/ImageFormatException.java	Fri Nov 16 09:19:22 2007 -0500
     3.3 @@ -0,0 +1,51 @@
     3.4 +/* ImageFormatException.java
     3.5 +   Copyright (C) 2007 Matthew Flaschen
     3.6 +
     3.7 +   This file is part of IcedTea
     3.8 +
     3.9 +   IcedTea is free software; you can redistribute it and/or modify
    3.10 +   it under the terms of the GNU General Public License as published by
    3.11 +   the Free Software Foundation; either version 2, or (at your option)
    3.12 +   any later version.
    3.13 +
    3.14 +   IcedTea is distributed in the hope that it will be useful, but
    3.15 +   WITHOUT ANY WARRANTY; without even the implied warranty of
    3.16 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.17 +   General Public License for more details.
    3.18 +
    3.19 +   You should have received a copy of the GNU General Public License
    3.20 +   along with GNU Classpath; see the file COPYING.  If not, write to the
    3.21 +   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    3.22 +   02110-1301 USA.
    3.23 +
    3.24 +   Linking this library statically or dynamically with other modules is
    3.25 +   making a combined work based on this library.  Thus, the terms and
    3.26 +   conditions of the GNU General Public License cover the whole
    3.27 +   combination.
    3.28 +
    3.29 +   As a special exception, the copyright holders of this library give you
    3.30 +   permission to link this library with independent modules to produce an
    3.31 +   executable, regardless of the license terms of these independent
    3.32 +   modules, and to copy and distribute the resulting executable under
    3.33 +   terms of your choice, provided that you also meet, for each linked
    3.34 +   independent module, the terms and conditions of the license of that
    3.35 +   module.  An independent module is a module which is not derived from
    3.36 +   or based on this library.  If you modify this library, you may extend
    3.37 +   this exception to your version of the library, but you are not
    3.38 +   obligated to do so.  If you do not wish to do so, delete this
    3.39 +   exception statement from your version. */
    3.40 +
    3.41 +package com.sun.image.codec.jpeg;
    3.42 +
    3.43 +public class ImageFormatException extends RuntimeException
    3.44 +{
    3.45 +	public ImageFormatException()
    3.46 +	{
    3.47 +		this("");
    3.48 +	}
    3.49 +
    3.50 +	public ImageFormatException(String s)
    3.51 +	{
    3.52 +		super(s);
    3.53 +	}
    3.54 +}
     4.1 --- a/rt/com/sun/image/codec/jpeg/JPEGCodec.java	Fri Nov 16 13:18:29 2007 +0000
     4.2 +++ b/rt/com/sun/image/codec/jpeg/JPEGCodec.java	Fri Nov 16 09:19:22 2007 -0500
     4.3 @@ -1,5 +1,6 @@
     4.4  /* JPEGCodec.java -- 
     4.5     Copyright (C) 2007 Free Software Foundation, Inc.
     4.6 +   Copyright (C) 2007 Matthew Flaschen
     4.7  
     4.8     This file is part of GNU Classpath.
     4.9  
    4.10 @@ -39,22 +40,107 @@
    4.11  
    4.12  import java.io.InputStream;
    4.13  import java.io.OutputStream;
    4.14 -import com.sun.image.codec.jpeg.*;
    4.15 +import java.io.IOException;
    4.16 +
    4.17 +import java.awt.image.BufferedImage;
    4.18 +import java.awt.image.Raster;
    4.19 +
    4.20 +import javax.imageio.*;
    4.21 +import javax.imageio.stream.*;
    4.22 +import javax.imageio.plugins.jpeg.*;
    4.23 +
    4.24 +import java.util.Iterator;
    4.25  
    4.26  public class JPEGCodec
    4.27  {
    4.28  
    4.29 -	public JPEGCodec()
    4.30 -	{
    4.31 -	}	
    4.32 -
    4.33  	public static JPEGImageDecoder createJPEGDecoder(InputStream is)
    4.34  	{
    4.35 -		return null;
    4.36 +		return new ImageIOJPEGImageDecoder(is);
    4.37  	}
    4.38  
    4.39  	public static JPEGImageEncoder createJPEGEncoder(OutputStream os)
    4.40  	{
    4.41  		return null;
    4.42  	}
    4.43 +
    4.44 +	public static JPEGImageDecoder createJPEGDecoder(InputStream src, JPEGDecodeParam jdp)
    4.45 +	{
    4.46 +		return null; 
    4.47 +	}
    4.48 +        
    4.49 +	public static JPEGImageEncoder createJPEGEncoder(OutputStream dest, JPEGEncodeParam jep)
    4.50 +	{
    4.51 +		return null;
    4.52 +	}
    4.53 +        
    4.54 +	public static JPEGEncodeParam getDefaultJPEGEncodeParam(BufferedImage bi)
    4.55 +	{
    4.56 +		return null;
    4.57 +	}
    4.58 +        
    4.59 +	public static JPEGEncodeParam getDefaultJPEGEncodeParam(int numBands, int colorID)
    4.60 +	{
    4.61 +		return null;
    4.62 +	}
    4.63 +		
    4.64 +	public static JPEGEncodeParam getDefaultJPEGEncodeParam(JPEGDecodeParam jdp)
    4.65 +	{
    4.66 +		return null;
    4.67 +	}
    4.68 +        
    4.69 +	public static JPEGEncodeParam getDefaultJPEGEncodeParam(Raster ras, int colorID)
    4.70 +	{
    4.71 +		return null;
    4.72 +	}
    4.73 +        
    4.74 +
    4.75 +	private static class ImageIOJPEGImageDecoder implements JPEGImageDecoder
    4.76 +	{
    4.77 +		
    4.78 +		private static final String JPGMime = "image/jpeg";
    4.79 +    
    4.80 +		private ImageReader JPGReader;
    4.81 +		
    4.82 +		private InputStream in;
    4.83 +		
    4.84 +		private ImageIOJPEGImageDecoder (InputStream newIs)
    4.85 +		{
    4.86 +			in = newIs;
    4.87 +			
    4.88 +			Iterator<ImageReader> JPGReaderIter = ImageIO.getImageReadersByMIMEType(JPGMime);
    4.89 +			if(JPGReaderIter.hasNext())
    4.90 +			{
    4.91 +				JPGReader  = JPGReaderIter.next();
    4.92 +			}
    4.93 +			
    4.94 +			JPGReader.setInput(new MemoryCacheImageInputStream(in));
    4.95 +		}
    4.96 +
    4.97 +		public BufferedImage decodeAsBufferedImage() throws IOException, ImageFormatException
    4.98 +		{
    4.99 +			return JPGReader.read(0);
   4.100 +		}
   4.101 +		
   4.102 +		public Raster decodeAsRaster() throws IOException, ImageFormatException
   4.103 +		{
   4.104 +			return JPGReader.readRaster(0, null);
   4.105 +		}
   4.106 +		
   4.107 +		public InputStream getInputStream()
   4.108 +		{
   4.109 +			return in;
   4.110 +		}
   4.111 +		
   4.112 +		public JPEGDecodeParam getJPEGDecodeParam()
   4.113 +		{
   4.114 +			return null;
   4.115 +		}
   4.116 +
   4.117 +		public void setJPEGDecodeParam(JPEGDecodeParam jdp)
   4.118 +		{
   4.119 +			return;
   4.120 +		}
   4.121 +
   4.122 +	}
   4.123  }
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/rt/com/sun/image/codec/jpeg/JPEGDecodeParam.java	Fri Nov 16 09:19:22 2007 -0500
     5.3 @@ -0,0 +1,44 @@
     5.4 +/* JPEGImageDecoder.java -- 
     5.5 +   Copyright (C) 2007 Free Software Foundation, Inc.
     5.6 +   Copyright (C) 2007 Matthew Flaschen
     5.7 +
     5.8 +   This file is part of GNU Classpath.
     5.9 +
    5.10 +   GNU Classpath is free software; you can redistribute it and/or modify
    5.11 +   it under the terms of the GNU General Public License as published by
    5.12 +   the Free Software Foundation; either version 2, or (at your option)
    5.13 +   any later version.
    5.14 +
    5.15 +   GNU Classpath is distributed in the hope that it will be useful, but
    5.16 +   WITHOUT ANY WARRANTY; without even the implied warranty of
    5.17 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    5.18 +   General Public License for more details.
    5.19 +
    5.20 +   You should have received a copy of the GNU General Public License
    5.21 +   along with GNU Classpath; see the file COPYING.  If not, write to the
    5.22 +   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    5.23 +   02110-1301 USA.
    5.24 +
    5.25 +   Linking this library statically or dynamically with other modules is
    5.26 +   making a combined work based on this library.  Thus, the terms and
    5.27 +   conditions of the GNU General Public License cover the whole
    5.28 +   combination.
    5.29 +
    5.30 +   As a special exception, the copyright holders of this library give you
    5.31 +   permission to link this library with independent modules to produce an
    5.32 +   executable, regardless of the license terms of these independent
    5.33 +   modules, and to copy and distribute the resulting executable under
    5.34 +   terms of your choice, provided that you also meet, for each linked
    5.35 +   independent module, the terms and conditions of the license of that
    5.36 +   module.  An independent module is a module which is not derived from
    5.37 +   or based on this library.  If you modify this library, you may extend
    5.38 +   this exception to your version of the library, but you are not
    5.39 +   obligated to do so.  If you do not wish to do so, delete this
    5.40 +   exception statement from your version. */
    5.41 +
    5.42 +package com.sun.image.codec.jpeg;
    5.43 +
    5.44 +public interface JPEGDecodeParam
    5.45 +{
    5.46 +
    5.47 +}
     6.1 --- a/rt/com/sun/image/codec/jpeg/JPEGImageDecoder.java	Fri Nov 16 13:18:29 2007 +0000
     6.2 +++ b/rt/com/sun/image/codec/jpeg/JPEGImageDecoder.java	Fri Nov 16 09:19:22 2007 -0500
     6.3 @@ -1,5 +1,6 @@
     6.4  /* JPEGImageDecoder.java -- 
     6.5     Copyright (C) 2007 Free Software Foundation, Inc.
     6.6 +   Copyright (C) 2007 Matthew Flaschen
     6.7  
     6.8     This file is part of GNU Classpath.
     6.9  
    6.10 @@ -38,12 +39,22 @@
    6.11  
    6.12  package com.sun.image.codec.jpeg;
    6.13  import java.awt.image.BufferedImage;
    6.14 +import java.awt.image.Raster;
    6.15  
    6.16 -public class JPEGImageDecoder
    6.17 +import java.io.InputStream;
    6.18 +import java.io.IOException;
    6.19 +
    6.20 +
    6.21 +public interface JPEGImageDecoder
    6.22  {
    6.23  
    6.24 -	public BufferedImage decodeAsBufferedImage()
    6.25 -	{
    6.26 -		return null;
    6.27 -	}
    6.28 +	public BufferedImage decodeAsBufferedImage() throws IOException, ImageFormatException;
    6.29 +	
    6.30 +	public Raster decodeAsRaster() throws IOException, ImageFormatException;
    6.31 +	
    6.32 +	public InputStream getInputStream();
    6.33 +
    6.34 +	public JPEGDecodeParam getJPEGDecodeParam();
    6.35 +
    6.36 +	public void setJPEGDecodeParam(JPEGDecodeParam jdp);
    6.37  }