/*
* @(#)ImageTypeSpecifier.java 1.35 05/11/17
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package javax.imageio;
import java.awt.Point;
import java.awt.Transparency;
import java.awt.image.BandedSampleModel;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.color.ColorSpace;
import java.awt.image.IndexColorModel;
import java.awt.image.ComponentColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DirectColorModel;
import java.awt.image.MultiPixelPackedSampleModel;
import java.awt.image.PixelInterleavedSampleModel;
import java.awt.image.SinglePixelPackedSampleModel;
import java.awt.image.Raster;
import java.awt.image.RenderedImage;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import java.util.Hashtable;
/**
* A class that allows the format of an image (in particular, its
* <code>SampleModel</code> and <code>ColorModel</code>) to be
* specified in a convenient manner.
*
* @version 0.5
*/
public class ImageTypeSpecifier {
/**
* The <code>ColorModel</code> to be used as a prototype.
*/
protected ColorModel colorModel;
/**
* A <code>SampleModel</code> to be used as a prototype.
*/
protected SampleModel sampleModel;
/**
* Cached specifiers for all of the standard
* <code>BufferedImage</code> types.
*/
private static ImageTypeSpecifier[] BISpecifier;
// Initialize the standard specifiers
static {
ColorSpace sRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB);
BISpecifier =
new ImageTypeSpecifier[BufferedImage.TYPE_BYTE_INDEXED + 1];
BISpecifier[BufferedImage.TYPE_CUSTOM] = null;
BISpecifier[BufferedImage.TYPE_INT_RGB] =
createPacked(sRGB,
0x00ff0000,
0x0000ff00,
0x000000ff,
0x0,
DataBuffer.TYPE_INT,
false);
BISpecifier[BufferedImage.TYPE_INT_ARGB] =
createPacked(sRGB,
0x00ff0000,
0x0000ff00,
0x000000ff,
0xff000000,
DataBuffer.TYPE_INT,
false);
BISpecifier[BufferedImage.TYPE_INT_ARGB_PRE] =
createPacked(sRGB,
0x00ff0000,
0x0000ff00,
0x000000ff,
0xff000000,
DataBuffer.TYPE_INT,
true);
BISpecifier[BufferedImage.TYPE_INT_BGR] =
createPacked(sRGB,
0x000000ff,
0x0000ff00,
0x00ff0000,
0x0,
DataBuffer.TYPE_INT,
false);
int[] bOffsRGB = { 2, 1, 0 };
BISpecifier[BufferedImage.TYPE_3BYTE_BGR] =
=1= |