/[classpath]/classpath/java/awt/image/ColorConvertOp.java
ViewVC logotype

Diff of /classpath/java/awt/image/ColorConvertOp.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3.2.1 by gnu_andrew, Sat Jan 15 17:01:49 2005 UTC revision 1.3.2.2 by gnu_andrew, Sun Jan 16 02:14:47 2005 UTC
# Line 1  Line 1 
1  /* ColorModel.java --  /* ColorModel.java --
2  Copyright (C) 2004  Free Software Foundation     Copyright (C) 2004  Free Software Foundation
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 35  this exception to your version of the li Line 35  this exception to your version of the li
35  obligated to do so.  If you do not wish to do so, delete this  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */  exception statement from your version. */
37    
38    
39  package java.awt.image;  package java.awt.image;
40    
41  import java.awt.Graphics2D;  import java.awt.Graphics2D;
# Line 156  public class ColorConvertOp implements B Line 157  public class ColorConvertOp implements B
157     * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage,     * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage,
158     java.awt.image.BufferedImage)     java.awt.image.BufferedImage)
159     */     */
160    public BufferedImage filter(BufferedImage src, BufferedImage dst)    public final BufferedImage filter(BufferedImage src, BufferedImage dst)
161    {    {
162      // TODO: The plan is to create a scanline buffer for intermediate buffers.      // TODO: The plan is to create a scanline buffer for intermediate buffers.
163      // For now we just suck it up and create intermediate buffers.      // For now we just suck it up and create intermediate buffers.
# Line 204  public class ColorConvertOp implements B Line 205  public class ColorConvertOp implements B
205                               null);                               null);
206    }    }
207        
208    public ICC_Profile[] getICC_Profiles()    public final ICC_Profile[] getICC_Profiles()
209    {    {
210      return profiles;      return profiles;
211    }    }
212    
213    /** Return the rendering hints for this op. */    /** Return the rendering hints for this op. */
214    public RenderingHints getRenderingHints()    public final RenderingHints getRenderingHints()
215    {    {
216      return hints;      return hints;
217    }    }
# Line 218  public class ColorConvertOp implements B Line 219  public class ColorConvertOp implements B
219    /* (non-Javadoc)    /* (non-Javadoc)
220     * @see java.awt.image.RasterOp#filter(java.awt.image.Raster, java.awt.image.WritableRaster)     * @see java.awt.image.RasterOp#filter(java.awt.image.Raster, java.awt.image.WritableRaster)
221     */     */
222    public WritableRaster filter(Raster src, WritableRaster dest)    public final WritableRaster filter(Raster src, WritableRaster dest)
223    {    {
224      if (!rasterValid)      if (!rasterValid)
225        throw new IllegalArgumentException();        throw new IllegalArgumentException();
# Line 258  public class ColorConvertOp implements B Line 259  public class ColorConvertOp implements B
259     * @param dst The destination point.     * @param dst The destination point.
260     * @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D, java.awt.geom.Point2D)     * @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D, java.awt.geom.Point2D)
261     */     */
262    public Point2D getPoint2D(Point2D src, Point2D dst)    public final Point2D getPoint2D(Point2D src, Point2D dst)
263    {    {
264      if (dst == null) return (Point2D)src.clone();      if (dst == null) return (Point2D)src.clone();
265      dst.setLocation(src);      dst.setLocation(src);
# Line 268  public class ColorConvertOp implements B Line 269  public class ColorConvertOp implements B
269    /* (non-Javadoc)    /* (non-Javadoc)
270     * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)     * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
271     */     */
272    public Rectangle2D getBounds2D(BufferedImage src)    public final Rectangle2D getBounds2D(BufferedImage src)
273    {    {
274      return src.getRaster().getBounds();      return src.getRaster().getBounds();
275    }    }
# Line 276  public class ColorConvertOp implements B Line 277  public class ColorConvertOp implements B
277    /* (non-Javadoc)    /* (non-Javadoc)
278     * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)     * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
279     */     */
280    public Rectangle2D getBounds2D(Raster src)    public final Rectangle2D getBounds2D(Raster src)
281    {    {
282      return src.getBounds();      return src.getBounds();
283    }    }
# Line 300  public class ColorConvertOp implements B Line 301  public class ColorConvertOp implements B
301          RenderingHints.VALUE_COLOR_RENDER_QUALITY)          RenderingHints.VALUE_COLOR_RENDER_QUALITY)
302      {      {
303        // use cie for accuracy        // use cie for accuracy
304        for (int y = src.getMinY(); y < src.getHeight() - src.getMinY(); y++)        for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
305          for (int x = src.getMinX(); x < src.getWidth() - src.getMinX(); x++)          for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
306            dst.setPixel(x, y,            dst.setPixel(x, y,
307                         dcs.fromCIEXYZ(scs.toCIEXYZ(src.getPixel(x, y, sbuf))));                         dcs.fromCIEXYZ(scs.toCIEXYZ(src.getPixel(x, y, sbuf))));
308      }      }
309      else      else
310      {      {
311        // use rgb - it's probably faster        // use rgb - it's probably faster
312        for (int y = src.getMinY(); y < src.getHeight() - src.getMinY(); y++)        for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
313          for (int x = src.getMinX(); x < src.getWidth() - src.getMinX(); x++)          for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
314            dst.setPixel(x, y,            dst.setPixel(x, y,
315                         dcs.fromRGB(scs.toRGB(src.getPixel(x, y, sbuf))));                         dcs.fromRGB(scs.toRGB(src.getPixel(x, y, sbuf))));
316      }      }

Legend:
Removed from v.1.3.2.1  
changed lines
  Added in v.1.3.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26