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 |
|
|
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; |
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. |
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 |
} |
} |
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(); |
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); |
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 |
} |
} |
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 |
} |
} |
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 |
} |
} |