< prev index next >

src/java.desktop/share/classes/java/awt/image/DirectColorModel.java

Print this page

        

*** 27,49 **** import java.awt.color.ColorSpace; import java.awt.Transparency; /** ! * The <code>DirectColorModel</code> class is a <code>ColorModel</code> * class that works with pixel values that represent RGB * color and alpha information as separate samples and that pack all * samples for a single pixel into a single int, short, or byte quantity. * This class can be used only with ColorSpaces of type ColorSpace.TYPE_RGB. * In addition, for each component of the ColorSpace, the minimum ! * normalized component value obtained via the <code>getMinValue()</code> * method of ColorSpace must be 0.0, and the maximum value obtained via ! * the <code>getMaxValue()</code> method must be 1.0 (these min/max * values are typical for RGB spaces). * There must be three color samples in the pixel values and there can * be a single alpha sample. For those methods that use a primitive array ! * pixel representation of type <code>transferType</code>, the array * length is always one. The transfer * types supported are DataBuffer.TYPE_BYTE, * DataBuffer.TYPE_USHORT, and DataBuffer.TYPE_INT. * Color and alpha samples are stored in the single * element of the array in bits indicated by bit masks. Each bit mask --- 27,49 ---- import java.awt.color.ColorSpace; import java.awt.Transparency; /** ! * The {@code DirectColorModel} class is a {@code ColorModel} * class that works with pixel values that represent RGB * color and alpha information as separate samples and that pack all * samples for a single pixel into a single int, short, or byte quantity. * This class can be used only with ColorSpaces of type ColorSpace.TYPE_RGB. * In addition, for each component of the ColorSpace, the minimum ! * normalized component value obtained via the {@code getMinValue()} * method of ColorSpace must be 0.0, and the maximum value obtained via ! * the {@code getMaxValue()} method must be 1.0 (these min/max * values are typical for RGB spaces). * There must be three color samples in the pixel values and there can * be a single alpha sample. For those methods that use a primitive array ! * pixel representation of type {@code transferType}, the array * length is always one. The transfer * types supported are DataBuffer.TYPE_BYTE, * DataBuffer.TYPE_USHORT, and DataBuffer.TYPE_INT. * Color and alpha samples are stored in the single * element of the array in bits indicated by bit masks. Each bit mask
*** 58,87 **** * <li> Index 3 corresponds to the alpha sample, if present. * </ul> * <p> * The translation from pixel values to color/alpha components for * display or processing purposes is a one-to-one correspondence of ! * samples to components. A <code>DirectColorModel</code> is * typically used with image data which uses masks to define packed ! * samples. For example, a <code>DirectColorModel</code> can be used in ! * conjunction with a <code>SinglePixelPackedSampleModel</code> to * construct a {@link BufferedImage}. Normally the masks used by the ! * {@link SampleModel} and the <code>ColorModel</code> would be the * same. However, if they are different, the color interpretation * of pixel data will be done according to the masks of the ! * <code>ColorModel</code>. * <p> * A single int pixel representation is valid for all objects of this * class, since it is always possible to represent pixel values used with * this class in a single int. Therefore, methods which use this ! * representation will not throw an <code>IllegalArgumentException</code> * due to an invalid pixel value. * <p> * This color model is similar to an X11 TrueColor visual. * The default RGB ColorModel specified by the * {@link ColorModel#getRGBdefault() getRGBdefault} method is a ! * <code>DirectColorModel</code> with the following parameters: * <pre> * Number of bits: 32 * Red mask: 0x00ff0000 * Green mask: 0x0000ff00 * Blue mask: 0x000000ff --- 58,87 ---- * <li> Index 3 corresponds to the alpha sample, if present. * </ul> * <p> * The translation from pixel values to color/alpha components for * display or processing purposes is a one-to-one correspondence of ! * samples to components. A {@code DirectColorModel} is * typically used with image data which uses masks to define packed ! * samples. For example, a {@code DirectColorModel} can be used in ! * conjunction with a {@code SinglePixelPackedSampleModel} to * construct a {@link BufferedImage}. Normally the masks used by the ! * {@link SampleModel} and the {@code ColorModel} would be the * same. However, if they are different, the color interpretation * of pixel data will be done according to the masks of the ! * {@code ColorModel}. * <p> * A single int pixel representation is valid for all objects of this * class, since it is always possible to represent pixel values used with * this class in a single int. Therefore, methods which use this ! * representation will not throw an {@code IllegalArgumentException} * due to an invalid pixel value. * <p> * This color model is similar to an X11 TrueColor visual. * The default RGB ColorModel specified by the * {@link ColorModel#getRGBdefault() getRGBdefault} method is a ! * {@code DirectColorModel} with the following parameters: * <pre> * Number of bits: 32 * Red mask: 0x00ff0000 * Green mask: 0x0000ff00 * Blue mask: 0x000000ff
*** 124,141 **** private byte[] tosRGB8LUT; private byte[] fromsRGB8LUT8; private short[] fromsRGB8LUT16; /** ! * Constructs a <code>DirectColorModel</code> from the specified masks ! * that indicate which bits in an <code>int</code> pixel representation * contain the red, green and blue color samples. As pixel values do not * contain alpha information, all pixels are treated as opaque, which * means that alpha&nbsp;=&nbsp;1.0. All of the bits * in each mask must be contiguous and fit in the specified number ! * of least significant bits of an <code>int</code> pixel representation. ! * The <code>ColorSpace</code> is the default sRGB space. The * transparency value is Transparency.OPAQUE. The transfer type * is the smallest of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, * or DataBuffer.TYPE_INT that can hold a single pixel. * @param bits the number of bits in the pixel values; for example, * the sum of the number of bits in the masks. --- 124,141 ---- private byte[] tosRGB8LUT; private byte[] fromsRGB8LUT8; private short[] fromsRGB8LUT16; /** ! * Constructs a {@code DirectColorModel} from the specified masks ! * that indicate which bits in an {@code int} pixel representation * contain the red, green and blue color samples. As pixel values do not * contain alpha information, all pixels are treated as opaque, which * means that alpha&nbsp;=&nbsp;1.0. All of the bits * in each mask must be contiguous and fit in the specified number ! * of least significant bits of an {@code int} pixel representation. ! * The {@code ColorSpace} is the default sRGB space. The * transparency value is Transparency.OPAQUE. The transfer type * is the smallest of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, * or DataBuffer.TYPE_INT that can hold a single pixel. * @param bits the number of bits in the pixel values; for example, * the sum of the number of bits in the masks.
*** 151,169 **** int rmask, int gmask, int bmask) { this(bits, rmask, gmask, bmask, 0); } /** ! * Constructs a <code>DirectColorModel</code> from the specified masks ! * that indicate which bits in an <code>int</code> pixel representation * contain the red, green and blue color samples and the alpha sample, ! * if present. If <code>amask</code> is 0, pixel values do not contain * alpha information and all pixels are treated as opaque, which means * that alpha&nbsp;=&nbsp;1.0. All of the bits in each mask must * be contiguous and fit in the specified number of least significant bits ! * of an <code>int</code> pixel representation. Alpha, if present, is not ! * premultiplied. The <code>ColorSpace</code> is the default sRGB space. * The transparency value is Transparency.OPAQUE if no alpha is * present, or Transparency.TRANSLUCENT otherwise. The transfer type * is the smallest of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, * or DataBuffer.TYPE_INT that can hold a single pixel. * @param bits the number of bits in the pixel values; for example, --- 151,169 ---- int rmask, int gmask, int bmask) { this(bits, rmask, gmask, bmask, 0); } /** ! * Constructs a {@code DirectColorModel} from the specified masks ! * that indicate which bits in an {@code int} pixel representation * contain the red, green and blue color samples and the alpha sample, ! * if present. If {@code amask} is 0, pixel values do not contain * alpha information and all pixels are treated as opaque, which means * that alpha&nbsp;=&nbsp;1.0. All of the bits in each mask must * be contiguous and fit in the specified number of least significant bits ! * of an {@code int} pixel representation. Alpha, if present, is not ! * premultiplied. The {@code ColorSpace} is the default sRGB space. * The transparency value is Transparency.OPAQUE if no alpha is * present, or Transparency.TRANSLUCENT otherwise. The transfer type * is the smallest of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, * or DataBuffer.TYPE_INT that can hold a single pixel. * @param bits the number of bits in the pixel values; for example,
*** 185,231 **** ColorModel.getDefaultTransferType(bits)); setFields(); } /** ! * Constructs a <code>DirectColorModel</code> from the specified * parameters. Color components are in the specified ! * <code>ColorSpace</code>, which must be of type ColorSpace.TYPE_RGB * and have minimum normalized component values which are all 0.0 * and maximum values which are all 1.0. ! * The masks specify which bits in an <code>int</code> pixel * representation contain the red, green and blue color samples and ! * the alpha sample, if present. If <code>amask</code> is 0, pixel * values do not contain alpha information and all pixels are treated * as opaque, which means that alpha&nbsp;=&nbsp;1.0. All of the * bits in each mask must be contiguous and fit in the specified number ! * of least significant bits of an <code>int</code> pixel ! * representation. If there is alpha, the <code>boolean</code> ! * <code>isAlphaPremultiplied</code> specifies how to interpret ! * color and alpha samples in pixel values. If the <code>boolean</code> ! * is <code>true</code>, color samples are assumed to have been * multiplied by the alpha sample. The transparency value is * Transparency.OPAQUE, if no alpha is present, or * Transparency.TRANSLUCENT otherwise. The transfer type * is the type of primitive array used to represent pixel values and * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or * DataBuffer.TYPE_INT. ! * @param space the specified <code>ColorSpace</code> * @param bits the number of bits in the pixel values; for example, * the sum of the number of bits in the masks. * @param rmask specifies a mask indicating which bits in an * integer pixel contain the red component * @param gmask specifies a mask indicating which bits in an * integer pixel contain the green component * @param bmask specifies a mask indicating which bits in an * integer pixel contain the blue component * @param amask specifies a mask indicating which bits in an * integer pixel contain the alpha component ! * @param isAlphaPremultiplied <code>true</code> if color samples are ! * premultiplied by the alpha sample; <code>false</code> otherwise * @param transferType the type of array used to represent pixel values ! * @throws IllegalArgumentException if <code>space</code> is not a * TYPE_RGB space or if the min/max normalized component * values are not 0.0/1.0. */ public DirectColorModel(ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask, --- 185,231 ---- ColorModel.getDefaultTransferType(bits)); setFields(); } /** ! * Constructs a {@code DirectColorModel} from the specified * parameters. Color components are in the specified ! * {@code ColorSpace}, which must be of type ColorSpace.TYPE_RGB * and have minimum normalized component values which are all 0.0 * and maximum values which are all 1.0. ! * The masks specify which bits in an {@code int} pixel * representation contain the red, green and blue color samples and ! * the alpha sample, if present. If {@code amask} is 0, pixel * values do not contain alpha information and all pixels are treated * as opaque, which means that alpha&nbsp;=&nbsp;1.0. All of the * bits in each mask must be contiguous and fit in the specified number ! * of least significant bits of an {@code int} pixel ! * representation. If there is alpha, the {@code boolean} ! * {@code isAlphaPremultiplied} specifies how to interpret ! * color and alpha samples in pixel values. If the {@code boolean} ! * is {@code true}, color samples are assumed to have been * multiplied by the alpha sample. The transparency value is * Transparency.OPAQUE, if no alpha is present, or * Transparency.TRANSLUCENT otherwise. The transfer type * is the type of primitive array used to represent pixel values and * must be one of DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, or * DataBuffer.TYPE_INT. ! * @param space the specified {@code ColorSpace} * @param bits the number of bits in the pixel values; for example, * the sum of the number of bits in the masks. * @param rmask specifies a mask indicating which bits in an * integer pixel contain the red component * @param gmask specifies a mask indicating which bits in an * integer pixel contain the green component * @param bmask specifies a mask indicating which bits in an * integer pixel contain the blue component * @param amask specifies a mask indicating which bits in an * integer pixel contain the alpha component ! * @param isAlphaPremultiplied {@code true} if color samples are ! * premultiplied by the alpha sample; {@code false} otherwise * @param transferType the type of array used to represent pixel values ! * @throws IllegalArgumentException if {@code space} is not a * TYPE_RGB space or if the min/max normalized component * values are not 0.0/1.0. */ public DirectColorModel(ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask,
*** 259,301 **** } setFields(); } /** ! * Returns the mask indicating which bits in an <code>int</code> pixel * representation contain the red color component. ! * @return the mask, which indicates which bits of the <code>int</code> * pixel representation contain the red color sample. */ public final int getRedMask() { return maskArray[0]; } /** ! * Returns the mask indicating which bits in an <code>int</code> pixel * representation contain the green color component. ! * @return the mask, which indicates which bits of the <code>int</code> * pixel representation contain the green color sample. */ public final int getGreenMask() { return maskArray[1]; } /** ! * Returns the mask indicating which bits in an <code>int</code> pixel * representation contain the blue color component. ! * @return the mask, which indicates which bits of the <code>int</code> * pixel representation contain the blue color sample. */ public final int getBlueMask() { return maskArray[2]; } /** ! * Returns the mask indicating which bits in an <code>int</code> pixel * representation contain the alpha component. ! * @return the mask, which indicates which bits of the <code>int</code> * pixel representation contain the alpha sample. */ public final int getAlphaMask() { if (supportsAlpha) { return maskArray[3]; --- 259,301 ---- } setFields(); } /** ! * Returns the mask indicating which bits in an {@code int} pixel * representation contain the red color component. ! * @return the mask, which indicates which bits of the {@code int} * pixel representation contain the red color sample. */ public final int getRedMask() { return maskArray[0]; } /** ! * Returns the mask indicating which bits in an {@code int} pixel * representation contain the green color component. ! * @return the mask, which indicates which bits of the {@code int} * pixel representation contain the green color sample. */ public final int getGreenMask() { return maskArray[1]; } /** ! * Returns the mask indicating which bits in an {@code int} pixel * representation contain the blue color component. ! * @return the mask, which indicates which bits of the {@code int} * pixel representation contain the blue color sample. */ public final int getBlueMask() { return maskArray[2]; } /** ! * Returns the mask indicating which bits in an {@code int} pixel * representation contain the alpha component. ! * @return the mask, which indicates which bits of the {@code int} * pixel representation contain the alpha sample. */ public final int getAlphaMask() { if (supportsAlpha) { return maskArray[3];
*** 352,371 **** } /** * Returns the red color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB <code>ColorSpace</code>, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * as an <code>int</code>. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the red value * is 0. * @param pixel the specified pixel * @return the red color component for the specified pixel, from ! * 0 to 255 in the sRGB <code>ColorSpace</code>. */ public final int getRed(int pixel) { if (is_sRGB) { return getsRGBComponentFromsRGB(pixel, 0); } else if (is_LinearRGB) { --- 352,371 ---- } /** * Returns the red color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB {@code ColorSpace}, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * as an {@code int}. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the red value * is 0. * @param pixel the specified pixel * @return the red color component for the specified pixel, from ! * 0 to 255 in the sRGB {@code ColorSpace}. */ public final int getRed(int pixel) { if (is_sRGB) { return getsRGBComponentFromsRGB(pixel, 0); } else if (is_LinearRGB) {
*** 375,394 **** return (int) (rgb[0] * 255.0f + 0.5f); } /** * Returns the green color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB <code>ColorSpace</code>, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * as an <code>int</code>. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the green value * is 0. * @param pixel the specified pixel * @return the green color component for the specified pixel, from ! * 0 to 255 in the sRGB <code>ColorSpace</code>. */ public final int getGreen(int pixel) { if (is_sRGB) { return getsRGBComponentFromsRGB(pixel, 1); } else if (is_LinearRGB) { --- 375,394 ---- return (int) (rgb[0] * 255.0f + 0.5f); } /** * Returns the green color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB {@code ColorSpace}, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * as an {@code int}. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the green value * is 0. * @param pixel the specified pixel * @return the green color component for the specified pixel, from ! * 0 to 255 in the sRGB {@code ColorSpace}. */ public final int getGreen(int pixel) { if (is_sRGB) { return getsRGBComponentFromsRGB(pixel, 1); } else if (is_LinearRGB) {
*** 398,417 **** return (int) (rgb[1] * 255.0f + 0.5f); } /** * Returns the blue color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB <code>ColorSpace</code>, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * as an <code>int</code>. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the blue value * is 0. * @param pixel the specified pixel * @return the blue color component for the specified pixel, from ! * 0 to 255 in the sRGB <code>ColorSpace</code>. */ public final int getBlue(int pixel) { if (is_sRGB) { return getsRGBComponentFromsRGB(pixel, 2); } else if (is_LinearRGB) { --- 398,417 ---- return (int) (rgb[1] * 255.0f + 0.5f); } /** * Returns the blue color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB {@code ColorSpace}, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * as an {@code int}. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the blue value * is 0. * @param pixel the specified pixel * @return the blue color component for the specified pixel, from ! * 0 to 255 in the sRGB {@code ColorSpace}. */ public final int getBlue(int pixel) { if (is_sRGB) { return getsRGBComponentFromsRGB(pixel, 2); } else if (is_LinearRGB) {
*** 421,433 **** return (int) (rgb[2] * 255.0f + 0.5f); } /** * Returns the alpha component for the specified pixel, scaled ! * from 0 to 255. The pixel value is specified as an <code>int</code>. * @param pixel the specified pixel ! * @return the value of the alpha component of <code>pixel</code> * from 0 to 255. */ public final int getAlpha(int pixel) { if (!supportsAlpha) return 255; int a = ((pixel & maskArray[3]) >>> maskOffsets[3]); --- 421,433 ---- return (int) (rgb[2] * 255.0f + 0.5f); } /** * Returns the alpha component for the specified pixel, scaled ! * from 0 to 255. The pixel value is specified as an {@code int}. * @param pixel the specified pixel ! * @return the value of the alpha component of {@code pixel} * from 0 to 255. */ public final int getAlpha(int pixel) { if (!supportsAlpha) return 255; int a = ((pixel & maskArray[3]) >>> maskOffsets[3]);
*** 438,448 **** } /** * Returns the color/alpha components of the pixel in the default * RGB color model format. A color conversion is done if necessary. ! * The pixel value is specified as an <code>int</code>. * The returned value is in a non pre-multiplied format. Thus, if * the alpha is premultiplied, this method divides it out of the * color components. If the alpha value is 0, for example, the color * values are each 0. * @param pixel the specified pixel --- 438,448 ---- } /** * Returns the color/alpha components of the pixel in the default * RGB color model format. A color conversion is done if necessary. ! * The pixel value is specified as an {@code int}. * The returned value is in a non pre-multiplied format. Thus, if * the alpha is premultiplied, this method divides it out of the * color components. If the alpha value is 0, for example, the color * values are each 0. * @param pixel the specified pixel
*** 464,500 **** | (((int) (rgb[2] * 255.0f + 0.5f)) << 0); } /** * Returns the red color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB <code>ColorSpace</code>, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * by an array of data elements of type <code>transferType</code> passed * in as an object reference. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the red value * is 0. ! * If <code>inData</code> is not a primitive array of type ! * <code>transferType</code>, a <code>ClassCastException</code> is ! * thrown. An <code>ArrayIndexOutOfBoundsException</code> is ! * thrown if <code>inData</code> is not large enough to hold a ! * pixel value for this <code>ColorModel</code>. Since ! * <code>DirectColorModel</code> can be subclassed, subclasses inherit * the implementation of this method and if they don't override it * then they throw an exception if they use an unsupported ! * <code>transferType</code>. ! * An <code>UnsupportedOperationException</code> is thrown if this ! * <code>transferType</code> is not supported by this ! * <code>ColorModel</code>. * @param inData the array containing the pixel value * @return the value of the red component of the specified pixel. ! * @throws ArrayIndexOutOfBoundsException if <code>inData</code> is not * large enough to hold a pixel value for this color model ! * @throws ClassCastException if <code>inData</code> is not a ! * primitive array of type <code>transferType</code> ! * @throws UnsupportedOperationException if this <code>transferType</code> * is not supported by this color model */ public int getRed(Object inData) { int pixel=0; switch (transferType) { --- 464,500 ---- | (((int) (rgb[2] * 255.0f + 0.5f)) << 0); } /** * Returns the red color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB {@code ColorSpace}, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * by an array of data elements of type {@code transferType} passed * in as an object reference. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the red value * is 0. ! * If {@code inData} is not a primitive array of type ! * {@code transferType}, a {@code ClassCastException} is ! * thrown. An {@code ArrayIndexOutOfBoundsException} is ! * thrown if {@code inData} is not large enough to hold a ! * pixel value for this {@code ColorModel}. Since ! * {@code DirectColorModel} can be subclassed, subclasses inherit * the implementation of this method and if they don't override it * then they throw an exception if they use an unsupported ! * {@code transferType}. ! * An {@code UnsupportedOperationException} is thrown if this ! * {@code transferType} is not supported by this ! * {@code ColorModel}. * @param inData the array containing the pixel value * @return the value of the red component of the specified pixel. ! * @throws ArrayIndexOutOfBoundsException if {@code inData} is not * large enough to hold a pixel value for this color model ! * @throws ClassCastException if {@code inData} is not a ! * primitive array of type {@code transferType} ! * @throws UnsupportedOperationException if this {@code transferType} * is not supported by this color model */ public int getRed(Object inData) { int pixel=0; switch (transferType) {
*** 518,553 **** } /** * Returns the green color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB <code>ColorSpace</code>, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * by an array of data elements of type <code>transferType</code> passed * in as an object reference. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the green value ! * is 0. If <code>inData</code> is not a primitive array of type ! * <code>transferType</code>, a <code>ClassCastException</code> is thrown. ! * An <code>ArrayIndexOutOfBoundsException</code> is ! * thrown if <code>inData</code> is not large enough to hold a pixel ! * value for this <code>ColorModel</code>. Since ! * <code>DirectColorModel</code> can be subclassed, subclasses inherit * the implementation of this method and if they don't override it * then they throw an exception if they use an unsupported ! * <code>transferType</code>. ! * An <code>UnsupportedOperationException</code> is ! * thrown if this <code>transferType</code> is not supported by this ! * <code>ColorModel</code>. * @param inData the array containing the pixel value * @return the value of the green component of the specified pixel. ! * @throws ArrayIndexOutOfBoundsException if <code>inData</code> is not * large enough to hold a pixel value for this color model ! * @throws ClassCastException if <code>inData</code> is not a ! * primitive array of type <code>transferType</code> ! * @throws UnsupportedOperationException if this <code>transferType</code> * is not supported by this color model */ public int getGreen(Object inData) { int pixel=0; switch (transferType) { --- 518,553 ---- } /** * Returns the green color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB {@code ColorSpace}, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * by an array of data elements of type {@code transferType} passed * in as an object reference. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the green value ! * is 0. If {@code inData} is not a primitive array of type ! * {@code transferType}, a {@code ClassCastException} is thrown. ! * An {@code ArrayIndexOutOfBoundsException} is ! * thrown if {@code inData} is not large enough to hold a pixel ! * value for this {@code ColorModel}. Since ! * {@code DirectColorModel} can be subclassed, subclasses inherit * the implementation of this method and if they don't override it * then they throw an exception if they use an unsupported ! * {@code transferType}. ! * An {@code UnsupportedOperationException} is ! * thrown if this {@code transferType} is not supported by this ! * {@code ColorModel}. * @param inData the array containing the pixel value * @return the value of the green component of the specified pixel. ! * @throws ArrayIndexOutOfBoundsException if {@code inData} is not * large enough to hold a pixel value for this color model ! * @throws ClassCastException if {@code inData} is not a ! * primitive array of type {@code transferType} ! * @throws UnsupportedOperationException if this {@code transferType} * is not supported by this color model */ public int getGreen(Object inData) { int pixel=0; switch (transferType) {
*** 571,606 **** } /** * Returns the blue color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB <code>ColorSpace</code>, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * by an array of data elements of type <code>transferType</code> passed * in as an object reference. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the blue value ! * is 0. If <code>inData</code> is not a primitive array of type ! * <code>transferType</code>, a <code>ClassCastException</code> is thrown. ! * An <code>ArrayIndexOutOfBoundsException</code> is ! * thrown if <code>inData</code> is not large enough to hold a pixel ! * value for this <code>ColorModel</code>. Since ! * <code>DirectColorModel</code> can be subclassed, subclasses inherit * the implementation of this method and if they don't override it * then they throw an exception if they use an unsupported ! * <code>transferType</code>. ! * An <code>UnsupportedOperationException</code> is ! * thrown if this <code>transferType</code> is not supported by this ! * <code>ColorModel</code>. * @param inData the array containing the pixel value * @return the value of the blue component of the specified pixel. ! * @throws ArrayIndexOutOfBoundsException if <code>inData</code> is not * large enough to hold a pixel value for this color model ! * @throws ClassCastException if <code>inData</code> is not a ! * primitive array of type <code>transferType</code> ! * @throws UnsupportedOperationException if this <code>transferType</code> * is not supported by this color model */ public int getBlue(Object inData) { int pixel=0; switch (transferType) { --- 571,606 ---- } /** * Returns the blue color component for the specified pixel, scaled ! * from 0 to 255 in the default RGB {@code ColorSpace}, sRGB. A * color conversion is done if necessary. The pixel value is specified ! * by an array of data elements of type {@code transferType} passed * in as an object reference. * The returned value is a non pre-multiplied value. Thus, if the * alpha is premultiplied, this method divides it out before returning * the value. If the alpha value is 0, for example, the blue value ! * is 0. If {@code inData} is not a primitive array of type ! * {@code transferType}, a {@code ClassCastException} is thrown. ! * An {@code ArrayIndexOutOfBoundsException} is ! * thrown if {@code inData} is not large enough to hold a pixel ! * value for this {@code ColorModel}. Since ! * {@code DirectColorModel} can be subclassed, subclasses inherit * the implementation of this method and if they don't override it * then they throw an exception if they use an unsupported ! * {@code transferType}. ! * An {@code UnsupportedOperationException} is ! * thrown if this {@code transferType} is not supported by this ! * {@code ColorModel}. * @param inData the array containing the pixel value * @return the value of the blue component of the specified pixel. ! * @throws ArrayIndexOutOfBoundsException if {@code inData} is not * large enough to hold a pixel value for this color model ! * @throws ClassCastException if {@code inData} is not a ! * primitive array of type {@code transferType} ! * @throws UnsupportedOperationException if this {@code transferType} * is not supported by this color model */ public int getBlue(Object inData) { int pixel=0; switch (transferType) {
*** 624,657 **** } /** * Returns the alpha component for the specified pixel, scaled * from 0 to 255. The pixel value is specified by an array of data ! * elements of type <code>transferType</code> passed in as an object * reference. ! * If <code>inData</code> is not a primitive array of type ! * <code>transferType</code>, a <code>ClassCastException</code> is ! * thrown. An <code>ArrayIndexOutOfBoundsException</code> is ! * thrown if <code>inData</code> is not large enough to hold a pixel ! * value for this <code>ColorModel</code>. Since ! * <code>DirectColorModel</code> can be subclassed, subclasses inherit * the implementation of this method and if they don't override it * then they throw an exception if they use an unsupported ! * <code>transferType</code>. ! * If this <code>transferType</code> is not supported, an ! * <code>UnsupportedOperationException</code> is thrown. * @param inData the specified pixel * @return the alpha component of the specified pixel, scaled from * 0 to 255. ! * @exception ClassCastException if <code>inData</code> ! * is not a primitive array of type <code>transferType</code> * @exception ArrayIndexOutOfBoundsException if ! * <code>inData</code> is not large enough to hold a pixel value ! * for this <code>ColorModel</code> * @exception UnsupportedOperationException if this ! * <code>tranferType</code> is not supported by this ! * <code>ColorModel</code> */ public int getAlpha(Object inData) { int pixel=0; switch (transferType) { case DataBuffer.TYPE_BYTE: --- 624,657 ---- } /** * Returns the alpha component for the specified pixel, scaled * from 0 to 255. The pixel value is specified by an array of data ! * elements of type {@code transferType} passed in as an object * reference. ! * If {@code inData} is not a primitive array of type ! * {@code transferType}, a {@code ClassCastException} is ! * thrown. An {@code ArrayIndexOutOfBoundsException} is ! * thrown if {@code inData} is not large enough to hold a pixel ! * value for this {@code ColorModel}. Since ! * {@code DirectColorModel} can be subclassed, subclasses inherit * the implementation of this method and if they don't override it * then they throw an exception if they use an unsupported ! * {@code transferType}. ! * If this {@code transferType} is not supported, an ! * {@code UnsupportedOperationException} is thrown. * @param inData the specified pixel * @return the alpha component of the specified pixel, scaled from * 0 to 255. ! * @exception ClassCastException if {@code inData} ! * is not a primitive array of type {@code transferType} * @exception ArrayIndexOutOfBoundsException if ! * {@code inData} is not large enough to hold a pixel value ! * for this {@code ColorModel} * @exception UnsupportedOperationException if this ! * {@code tranferType} is not supported by this ! * {@code ColorModel} */ public int getAlpha(Object inData) { int pixel=0; switch (transferType) { case DataBuffer.TYPE_BYTE:
*** 675,704 **** /** * Returns the color/alpha components for the specified pixel in the * default RGB color model format. A color conversion is done if * necessary. The pixel value is specified by an array of data ! * elements of type <code>transferType</code> passed in as an object ! * reference. If <code>inData</code> is not a primitive array of type ! * <code>transferType</code>, a <code>ClassCastException</code> is ! * thrown. An <code>ArrayIndexOutOfBoundsException</code> is ! * thrown if <code>inData</code> is not large enough to hold a pixel ! * value for this <code>ColorModel</code>. * The returned value is in a non pre-multiplied format. Thus, if * the alpha is premultiplied, this method divides it out of the * color components. If the alpha value is 0, for example, the color ! * values is 0. Since <code>DirectColorModel</code> can be * subclassed, subclasses inherit the implementation of this method * and if they don't override it then * they throw an exception if they use an unsupported ! * <code>transferType</code>. * * @param inData the specified pixel * @return the color and alpha components of the specified pixel. * @exception UnsupportedOperationException if this ! * <code>transferType</code> is not supported by this ! * <code>ColorModel</code> * @see ColorModel#getRGBdefault */ public int getRGB(Object inData) { int pixel=0; switch (transferType) { --- 675,704 ---- /** * Returns the color/alpha components for the specified pixel in the * default RGB color model format. A color conversion is done if * necessary. The pixel value is specified by an array of data ! * elements of type {@code transferType} passed in as an object ! * reference. If {@code inData} is not a primitive array of type ! * {@code transferType}, a {@code ClassCastException} is ! * thrown. An {@code ArrayIndexOutOfBoundsException} is ! * thrown if {@code inData} is not large enough to hold a pixel ! * value for this {@code ColorModel}. * The returned value is in a non pre-multiplied format. Thus, if * the alpha is premultiplied, this method divides it out of the * color components. If the alpha value is 0, for example, the color ! * values is 0. Since {@code DirectColorModel} can be * subclassed, subclasses inherit the implementation of this method * and if they don't override it then * they throw an exception if they use an unsupported ! * {@code transferType}. * * @param inData the specified pixel * @return the color and alpha components of the specified pixel. * @exception UnsupportedOperationException if this ! * {@code transferType} is not supported by this ! * {@code ColorModel} * @see ColorModel#getRGBdefault */ public int getRGB(Object inData) { int pixel=0; switch (transferType) {
*** 721,759 **** return getRGB(pixel); } /** * Returns a data element array representation of a pixel in this ! * <code>ColorModel</code>, given an integer pixel representation in the * default RGB color model. ! * This array can then be passed to the <code>setDataElements</code> ! * method of a <code>WritableRaster</code> object. If the pixel variable ! * is <code>null</code>, a new array is allocated. If <code>pixel</code> ! * is not <code>null</code>, it must be a primitive array of type ! * <code>transferType</code>; otherwise, a ! * <code>ClassCastException</code> is thrown. An ! * <code>ArrayIndexOutOfBoundsException</code> is ! * thrown if <code>pixel</code> is not large enough to hold a pixel ! * value for this <code>ColorModel</code>. The pixel array is returned. ! * Since <code>DirectColorModel</code> can be subclassed, subclasses * inherit the implementation of this method and if they don't * override it then they throw an exception if they use an unsupported ! * <code>transferType</code>. * * @param rgb the integer pixel representation in the default RGB * color model * @param pixel the specified pixel * @return an array representation of the specified pixel in this ! * <code>ColorModel</code> ! * @exception ClassCastException if <code>pixel</code> ! * is not a primitive array of type <code>transferType</code> * @exception ArrayIndexOutOfBoundsException if ! * <code>pixel</code> is not large enough to hold a pixel value ! * for this <code>ColorModel</code> * @exception UnsupportedOperationException if this ! * <code>transferType</code> is not supported by this ! * <code>ColorModel</code> * @see WritableRaster#setDataElements * @see SampleModel#setDataElements */ public Object getDataElements(int rgb, Object pixel) { //REMIND: maybe more efficient not to use int array for --- 721,759 ---- return getRGB(pixel); } /** * Returns a data element array representation of a pixel in this ! * {@code ColorModel}, given an integer pixel representation in the * default RGB color model. ! * This array can then be passed to the {@code setDataElements} ! * method of a {@code WritableRaster} object. If the pixel variable ! * is {@code null}, a new array is allocated. If {@code pixel} ! * is not {@code null}, it must be a primitive array of type ! * {@code transferType}; otherwise, a ! * {@code ClassCastException} is thrown. An ! * {@code ArrayIndexOutOfBoundsException} is ! * thrown if {@code pixel} is not large enough to hold a pixel ! * value for this {@code ColorModel}. The pixel array is returned. ! * Since {@code DirectColorModel} can be subclassed, subclasses * inherit the implementation of this method and if they don't * override it then they throw an exception if they use an unsupported ! * {@code transferType}. * * @param rgb the integer pixel representation in the default RGB * color model * @param pixel the specified pixel * @return an array representation of the specified pixel in this ! * {@code ColorModel} ! * @exception ClassCastException if {@code pixel} ! * is not a primitive array of type {@code transferType} * @exception ArrayIndexOutOfBoundsException if ! * {@code pixel} is not large enough to hold a pixel value ! * for this {@code ColorModel} * @exception UnsupportedOperationException if this ! * {@code transferType} is not supported by this ! * {@code ColorModel} * @see WritableRaster#setDataElements * @see SampleModel#setDataElements */ public Object getDataElements(int rgb, Object pixel) { //REMIND: maybe more efficient not to use int array for
*** 903,926 **** } /** * Returns an array of unnormalized color/alpha components given a pixel ! * in this <code>ColorModel</code>. The pixel value is specified as an ! * <code>int</code>. If the <code>components</code> array is ! * <code>null</code>, a new array is allocated. The ! * <code>components</code> array is returned. Color/alpha components are ! * stored in the <code>components</code> array starting at ! * <code>offset</code>, even if the array is allocated by this method. ! * An <code>ArrayIndexOutOfBoundsException</code> is thrown if the ! * <code>components</code> array is not <code>null</code> and is not large * enough to hold all the color and alpha components, starting at ! * <code>offset</code>. * @param pixel the specified pixel * @param components the array to receive the color and alpha * components of the specified pixel ! * @param offset the offset into the <code>components</code> array at * which to start storing the color and alpha components * @return an array containing the color and alpha components of the * specified pixel starting at the specified offset. */ public final int[] getComponents(int pixel, int[] components, int offset) { --- 903,926 ---- } /** * Returns an array of unnormalized color/alpha components given a pixel ! * in this {@code ColorModel}. The pixel value is specified as an ! * {@code int}. If the {@code components} array is ! * {@code null}, a new array is allocated. The ! * {@code components} array is returned. Color/alpha components are ! * stored in the {@code components} array starting at ! * {@code offset}, even if the array is allocated by this method. ! * An {@code ArrayIndexOutOfBoundsException} is thrown if the ! * {@code components} array is not {@code null} and is not large * enough to hold all the color and alpha components, starting at ! * {@code offset}. * @param pixel the specified pixel * @param components the array to receive the color and alpha * components of the specified pixel ! * @param offset the offset into the {@code components} array at * which to start storing the color and alpha components * @return an array containing the color and alpha components of the * specified pixel starting at the specified offset. */ public final int[] getComponents(int pixel, int[] components, int offset) {
*** 935,979 **** return components; } /** * Returns an array of unnormalized color/alpha components given a pixel ! * in this <code>ColorModel</code>. The pixel value is specified by an ! * array of data elements of type <code>transferType</code> passed in as ! * an object reference. If <code>pixel</code> is not a primitive array ! * of type <code>transferType</code>, a <code>ClassCastException</code> ! * is thrown. An <code>ArrayIndexOutOfBoundsException</code> is ! * thrown if <code>pixel</code> is not large enough to hold a ! * pixel value for this <code>ColorModel</code>. If the ! * <code>components</code> array is <code>null</code>, a new ! * array is allocated. The <code>components</code> array is returned. ! * Color/alpha components are stored in the <code>components</code> array ! * starting at <code>offset</code>, even if the array is allocated by ! * this method. An <code>ArrayIndexOutOfBoundsException</code> ! * is thrown if the <code>components</code> array is not ! * <code>null</code> and is not large enough to hold all the color and ! * alpha components, starting at <code>offset</code>. ! * Since <code>DirectColorModel</code> can be subclassed, subclasses * inherit the implementation of this method and if they don't * override it then they throw an exception if they use an unsupported ! * <code>transferType</code>. * @param pixel the specified pixel * @param components the array to receive the color and alpha * components of the specified pixel ! * @param offset the offset into the <code>components</code> array at * which to start storing the color and alpha components * @return an array containing the color and alpha components of the * specified pixel starting at the specified offset. ! * @exception ClassCastException if <code>pixel</code> ! * is not a primitive array of type <code>transferType</code> * @exception ArrayIndexOutOfBoundsException if ! * <code>pixel</code> is not large enough to hold a pixel value ! * for this <code>ColorModel</code>, or if <code>components</code> ! * is not <code>null</code> and is not large enough to hold all the ! * color and alpha components, starting at <code>offset</code> * @exception UnsupportedOperationException if this ! * <code>transferType</code> is not supported by this * color model */ public final int[] getComponents(Object pixel, int[] components, int offset) { int intpixel=0; --- 935,979 ---- return components; } /** * Returns an array of unnormalized color/alpha components given a pixel ! * in this {@code ColorModel}. The pixel value is specified by an ! * array of data elements of type {@code transferType} passed in as ! * an object reference. If {@code pixel} is not a primitive array ! * of type {@code transferType}, a {@code ClassCastException} ! * is thrown. An {@code ArrayIndexOutOfBoundsException} is ! * thrown if {@code pixel} is not large enough to hold a ! * pixel value for this {@code ColorModel}. If the ! * {@code components} array is {@code null}, a new ! * array is allocated. The {@code components} array is returned. ! * Color/alpha components are stored in the {@code components} array ! * starting at {@code offset}, even if the array is allocated by ! * this method. An {@code ArrayIndexOutOfBoundsException} ! * is thrown if the {@code components} array is not ! * {@code null} and is not large enough to hold all the color and ! * alpha components, starting at {@code offset}. ! * Since {@code DirectColorModel} can be subclassed, subclasses * inherit the implementation of this method and if they don't * override it then they throw an exception if they use an unsupported ! * {@code transferType}. * @param pixel the specified pixel * @param components the array to receive the color and alpha * components of the specified pixel ! * @param offset the offset into the {@code components} array at * which to start storing the color and alpha components * @return an array containing the color and alpha components of the * specified pixel starting at the specified offset. ! * @exception ClassCastException if {@code pixel} ! * is not a primitive array of type {@code transferType} * @exception ArrayIndexOutOfBoundsException if ! * {@code pixel} is not large enough to hold a pixel value ! * for this {@code ColorModel}, or if {@code components} ! * is not {@code null} and is not large enough to hold all the ! * color and alpha components, starting at {@code offset} * @exception UnsupportedOperationException if this ! * {@code transferType} is not supported by this * color model */ public final int[] getComponents(Object pixel, int[] components, int offset) { int intpixel=0;
*** 996,1013 **** } return getComponents(intpixel, components, offset); } /** ! * Creates a <code>WritableRaster</code> with the specified width and ! * height that has a data layout (<code>SampleModel</code>) compatible ! * with this <code>ColorModel</code>. ! * @param w the width to apply to the new <code>WritableRaster</code> ! * @param h the height to apply to the new <code>WritableRaster</code> ! * @return a <code>WritableRaster</code> object with the specified * width and height. ! * @throws IllegalArgumentException if <code>w</code> or <code>h</code> * is less than or equal to zero * @see WritableRaster * @see SampleModel */ public final WritableRaster createCompatibleWritableRaster (int w, --- 996,1013 ---- } return getComponents(intpixel, components, offset); } /** ! * Creates a {@code WritableRaster} with the specified width and ! * height that has a data layout ({@code SampleModel}) compatible ! * with this {@code ColorModel}. ! * @param w the width to apply to the new {@code WritableRaster} ! * @param h the height to apply to the new {@code WritableRaster} ! * @return a {@code WritableRaster} object with the specified * width and height. ! * @throws IllegalArgumentException if {@code w} or {@code h} * is less than or equal to zero * @see WritableRaster * @see SampleModel */ public final WritableRaster createCompatibleWritableRaster (int w,
*** 1041,1066 **** w,h,bandmasks,null); } } /** ! * Returns a pixel value represented as an <code>int</code> in this ! * <code>ColorModel</code>, given an array of unnormalized color/alpha ! * components. An <code>ArrayIndexOutOfBoundsException</code> is ! * thrown if the <code>components</code> array is * not large enough to hold all the color and alpha components, starting ! * at <code>offset</code>. * @param components an array of unnormalized color and alpha * components ! * @param offset the index into <code>components</code> at which to * begin retrieving the color and alpha components ! * @return an <code>int</code> pixel value in this ! * <code>ColorModel</code> corresponding to the specified components. * @exception ArrayIndexOutOfBoundsException if ! * the <code>components</code> array is not large enough to * hold all of the color and alpha components starting at ! * <code>offset</code> */ public int getDataElement(int[] components, int offset) { int pixel = 0; for (int i=0; i < numComponents; i++) { pixel |= ((components[offset+i]<<maskOffsets[i])&maskArray[i]); --- 1041,1066 ---- w,h,bandmasks,null); } } /** ! * Returns a pixel value represented as an {@code int} in this ! * {@code ColorModel}, given an array of unnormalized color/alpha ! * components. An {@code ArrayIndexOutOfBoundsException} is ! * thrown if the {@code components} array is * not large enough to hold all the color and alpha components, starting ! * at {@code offset}. * @param components an array of unnormalized color and alpha * components ! * @param offset the index into {@code components} at which to * begin retrieving the color and alpha components ! * @return an {@code int} pixel value in this ! * {@code ColorModel} corresponding to the specified components. * @exception ArrayIndexOutOfBoundsException if ! * the {@code components} array is not large enough to * hold all of the color and alpha components starting at ! * {@code offset} */ public int getDataElement(int[] components, int offset) { int pixel = 0; for (int i=0; i < numComponents; i++) { pixel |= ((components[offset+i]<<maskOffsets[i])&maskArray[i]);
*** 1068,1113 **** return pixel; } /** * Returns a data element array representation of a pixel in this ! * <code>ColorModel</code>, given an array of unnormalized color/alpha * components. ! * This array can then be passed to the <code>setDataElements</code> ! * method of a <code>WritableRaster</code> object. ! * An <code>ArrayIndexOutOfBoundsException</code> is thrown if the ! * <code>components</code> array * is not large enough to hold all the color and alpha components, ! * starting at offset. If the <code>obj</code> variable is ! * <code>null</code>, a new array is allocated. If <code>obj</code> is ! * not <code>null</code>, it must be a primitive array ! * of type <code>transferType</code>; otherwise, a ! * <code>ClassCastException</code> is thrown. ! * An <code>ArrayIndexOutOfBoundsException</code> is thrown if ! * <code>obj</code> is not large enough to hold a pixel value for this ! * <code>ColorModel</code>. ! * Since <code>DirectColorModel</code> can be subclassed, subclasses * inherit the implementation of this method and if they don't * override it then they throw an exception if they use an unsupported ! * <code>transferType</code>. * @param components an array of unnormalized color and alpha * components ! * @param offset the index into <code>components</code> at which to * begin retrieving color and alpha components ! * @param obj the <code>Object</code> representing an array of color * and alpha components ! * @return an <code>Object</code> representing an array of color and * alpha components. ! * @exception ClassCastException if <code>obj</code> ! * is not a primitive array of type <code>transferType</code> * @exception ArrayIndexOutOfBoundsException if ! * <code>obj</code> is not large enough to hold a pixel value ! * for this <code>ColorModel</code> or the <code>components</code> * array is not large enough to hold all of the color and alpha ! * components starting at <code>offset</code> * @exception UnsupportedOperationException if this ! * <code>transferType</code> is not supported by this * color model * @see WritableRaster#setDataElements * @see SampleModel#setDataElements */ public Object getDataElements(int[] components, int offset, Object obj) { --- 1068,1113 ---- return pixel; } /** * Returns a data element array representation of a pixel in this ! * {@code ColorModel}, given an array of unnormalized color/alpha * components. ! * This array can then be passed to the {@code setDataElements} ! * method of a {@code WritableRaster} object. ! * An {@code ArrayIndexOutOfBoundsException} is thrown if the ! * {@code components} array * is not large enough to hold all the color and alpha components, ! * starting at offset. If the {@code obj} variable is ! * {@code null}, a new array is allocated. If {@code obj} is ! * not {@code null}, it must be a primitive array ! * of type {@code transferType}; otherwise, a ! * {@code ClassCastException} is thrown. ! * An {@code ArrayIndexOutOfBoundsException} is thrown if ! * {@code obj} is not large enough to hold a pixel value for this ! * {@code ColorModel}. ! * Since {@code DirectColorModel} can be subclassed, subclasses * inherit the implementation of this method and if they don't * override it then they throw an exception if they use an unsupported ! * {@code transferType}. * @param components an array of unnormalized color and alpha * components ! * @param offset the index into {@code components} at which to * begin retrieving color and alpha components ! * @param obj the {@code Object} representing an array of color * and alpha components ! * @return an {@code Object} representing an array of color and * alpha components. ! * @exception ClassCastException if {@code obj} ! * is not a primitive array of type {@code transferType} * @exception ArrayIndexOutOfBoundsException if ! * {@code obj} is not large enough to hold a pixel value ! * for this {@code ColorModel} or the {@code components} * array is not large enough to hold all of the color and alpha ! * components starting at {@code offset} * @exception UnsupportedOperationException if this ! * {@code transferType} is not supported by this * color model * @see WritableRaster#setDataElements * @see SampleModel#setDataElements */ public Object getDataElements(int[] components, int offset, Object obj) {
*** 1149,1178 **** } } /** * Forces the raster data to match the state specified in the ! * <code>isAlphaPremultiplied</code> variable, assuming the data is ! * currently correctly described by this <code>ColorModel</code>. It * may multiply or divide the color raster data by alpha, or do * nothing if the data is in the correct state. If the data needs to * be coerced, this method will also return an instance of this ! * <code>ColorModel</code> with the <code>isAlphaPremultiplied</code> * flag set appropriately. This method will throw a ! * <code>UnsupportedOperationException</code> if this transferType is ! * not supported by this <code>ColorModel</code>. Since ! * <code>ColorModel</code> can be subclassed, subclasses inherit the * implementation of this method and if they don't override it then * they throw an exception if they use an unsupported transferType. * ! * @param raster the <code>WritableRaster</code> data ! * @param isAlphaPremultiplied <code>true</code> if the alpha is ! * premultiplied; <code>false</code> otherwise ! * @return a <code>ColorModel</code> object that represents the * coerced data. * @exception UnsupportedOperationException if this ! * <code>transferType</code> is not supported by this * color model */ public final ColorModel coerceData (WritableRaster raster, boolean isAlphaPremultiplied) { --- 1149,1178 ---- } } /** * Forces the raster data to match the state specified in the ! * {@code isAlphaPremultiplied} variable, assuming the data is ! * currently correctly described by this {@code ColorModel}. It * may multiply or divide the color raster data by alpha, or do * nothing if the data is in the correct state. If the data needs to * be coerced, this method will also return an instance of this ! * {@code ColorModel} with the {@code isAlphaPremultiplied} * flag set appropriately. This method will throw a ! * {@code UnsupportedOperationException} if this transferType is ! * not supported by this {@code ColorModel}. Since ! * {@code ColorModel} can be subclassed, subclasses inherit the * implementation of this method and if they don't override it then * they throw an exception if they use an unsupported transferType. * ! * @param raster the {@code WritableRaster} data ! * @param isAlphaPremultiplied {@code true} if the alpha is ! * premultiplied; {@code false} otherwise ! * @return a {@code ColorModel} object that represents the * coerced data. * @exception UnsupportedOperationException if this ! * {@code transferType} is not supported by this * color model */ public final ColorModel coerceData (WritableRaster raster, boolean isAlphaPremultiplied) {
*** 1341,1356 **** transferType); } /** ! * Returns <code>true</code> if <code>raster</code> is compatible ! * with this <code>ColorModel</code> and <code>false</code> if it is * not. * @param raster the {@link Raster} object to test for compatibility ! * @return <code>true</code> if <code>raster</code> is compatible ! * with this <code>ColorModel</code>; <code>false</code> otherwise. */ public boolean isCompatibleRaster(Raster raster) { SampleModel sm = raster.getSampleModel(); SinglePixelPackedSampleModel spsm; if (sm instanceof SinglePixelPackedSampleModel) { --- 1341,1356 ---- transferType); } /** ! * Returns {@code true} if {@code raster} is compatible ! * with this {@code ColorModel} and {@code false} if it is * not. * @param raster the {@link Raster} object to test for compatibility ! * @return {@code true} if {@code raster} is compatible ! * with this {@code ColorModel}; {@code false} otherwise. */ public boolean isCompatibleRaster(Raster raster) { SampleModel sm = raster.getSampleModel(); SinglePixelPackedSampleModel spsm; if (sm instanceof SinglePixelPackedSampleModel) {
*** 1399,1412 **** } } } /** ! * Returns a <code>String</code> that represents this ! * <code>DirectColorModel</code>. ! * @return a <code>String</code> representing this ! * <code>DirectColorModel</code>. */ public String toString() { return new String("DirectColorModel: rmask=" +Integer.toHexString(red_mask)+" gmask=" +Integer.toHexString(green_mask)+" bmask=" --- 1399,1412 ---- } } } /** ! * Returns a {@code String} that represents this ! * {@code DirectColorModel}. ! * @return a {@code String} representing this ! * {@code DirectColorModel}. */ public String toString() { return new String("DirectColorModel: rmask=" +Integer.toHexString(red_mask)+" gmask=" +Integer.toHexString(green_mask)+" bmask="
< prev index next >