src/java.desktop/share/classes/java/awt/image/DirectColorModel.java
Print this page
*** 264,304 ****
* 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.
*/
! final public 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.
*/
! final public 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.
*/
! final public 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.
*/
! final public int getAlphaMask() {
if (supportsAlpha) {
return maskArray[3];
} else {
return 0;
}
--- 264,304 ----
* 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];
} else {
return 0;
}
*** 363,373 ****
* 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>.
*/
! final public int getRed(int pixel) {
if (is_sRGB) {
return getsRGBComponentFromsRGB(pixel, 0);
} else if (is_LinearRGB) {
return getsRGBComponentFromLinearRGB(pixel, 0);
}
--- 363,373 ----
* 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) {
return getsRGBComponentFromLinearRGB(pixel, 0);
}
*** 386,396 ****
* 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>.
*/
! final public int getGreen(int pixel) {
if (is_sRGB) {
return getsRGBComponentFromsRGB(pixel, 1);
} else if (is_LinearRGB) {
return getsRGBComponentFromLinearRGB(pixel, 1);
}
--- 386,396 ----
* 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) {
return getsRGBComponentFromLinearRGB(pixel, 1);
}
*** 409,419 ****
* 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>.
*/
! final public int getBlue(int pixel) {
if (is_sRGB) {
return getsRGBComponentFromsRGB(pixel, 2);
} else if (is_LinearRGB) {
return getsRGBComponentFromLinearRGB(pixel, 2);
}
--- 409,419 ----
* 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) {
return getsRGBComponentFromLinearRGB(pixel, 2);
}
*** 426,436 ****
* 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.
*/
! final public int getAlpha(int pixel) {
if (!supportsAlpha) return 255;
int a = ((pixel & maskArray[3]) >>> maskOffsets[3]);
if (scaleFactors[3] != 1.0f) {
a = (int)(a * scaleFactors[3] + 0.5f);
}
--- 426,436 ----
* 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]);
if (scaleFactors[3] != 1.0f) {
a = (int)(a * scaleFactors[3] + 0.5f);
}
*** 448,458 ****
* @param pixel the specified pixel
* @return the RGB value of the color/alpha components of the specified
* pixel.
* @see ColorModel#getRGBdefault
*/
! final public int getRGB(int pixel) {
if (is_sRGB || is_LinearRGB) {
return (getAlpha(pixel) << 24)
| (getRed(pixel) << 16)
| (getGreen(pixel) << 8)
| (getBlue(pixel) << 0);
--- 448,458 ----
* @param pixel the specified pixel
* @return the RGB value of the color/alpha components of the specified
* pixel.
* @see ColorModel#getRGBdefault
*/
! public final int getRGB(int pixel) {
if (is_sRGB || is_LinearRGB) {
return (getAlpha(pixel) << 24)
| (getRed(pixel) << 16)
| (getGreen(pixel) << 8)
| (getBlue(pixel) << 0);
*** 921,931 ****
* @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.
*/
! final public int[] getComponents(int pixel, int[] components, int offset) {
if (components == null) {
components = new int[offset+numComponents];
}
for (int i=0; i < numComponents; i++) {
--- 921,931 ----
* @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) {
if (components == null) {
components = new int[offset+numComponents];
}
for (int i=0; i < numComponents; i++) {
*** 972,982 ****
* color and alpha components, starting at <code>offset</code>
* @exception UnsupportedOperationException if this
* <code>transferType</code> is not supported by this
* color model
*/
! final public int[] getComponents(Object pixel, int[] components,
int offset) {
int intpixel=0;
switch (transferType) {
case DataBuffer.TYPE_BYTE:
byte bdata[] = (byte[])pixel;
--- 972,982 ----
* 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;
switch (transferType) {
case DataBuffer.TYPE_BYTE:
byte bdata[] = (byte[])pixel;
*** 1008,1018 ****
* @throws IllegalArgumentException if <code>w</code> or <code>h</code>
* is less than or equal to zero
* @see WritableRaster
* @see SampleModel
*/
! final public WritableRaster createCompatibleWritableRaster (int w,
int h) {
if ((w <= 0) || (h <= 0)) {
throw new IllegalArgumentException("Width (" + w + ") and height (" + h +
") cannot be <= 0");
}
--- 1008,1018 ----
* @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,
int h) {
if ((w <= 0) || (h <= 0)) {
throw new IllegalArgumentException("Width (" + w + ") and height (" + h +
") cannot be <= 0");
}
*** 1171,1181 ****
* coerced data.
* @exception UnsupportedOperationException if this
* <code>transferType</code> is not supported by this
* color model
*/
! final public ColorModel coerceData (WritableRaster raster,
boolean isAlphaPremultiplied)
{
if (!supportsAlpha ||
this.isAlphaPremultiplied() == isAlphaPremultiplied) {
return this;
--- 1171,1181 ----
* coerced data.
* @exception UnsupportedOperationException if this
* <code>transferType</code> is not supported by this
* color model
*/
! public final ColorModel coerceData (WritableRaster raster,
boolean isAlphaPremultiplied)
{
if (!supportsAlpha ||
this.isAlphaPremultiplied() == isAlphaPremultiplied) {
return this;