src/share/classes/java/awt/image/PackedColorModel.java

Print this page




 235      * @return the mask, which indicates which bits of the <code>int</code>
 236      *         pixel representation contain the color or alpha sample specified
 237      *         by <code>index</code>.
 238      * @throws ArrayIndexOutOfBoundsException if <code>index</code> is
 239      *         greater than the number of components minus 1 in this
 240      *         <code>PackedColorModel</code> or if <code>index</code> is
 241      *         less than zero
 242      */
 243     final public int getMask(int index) {
 244         return maskArray[index];
 245     }
 246 
 247     /**
 248      * Returns a mask array indicating which bits in a pixel
 249      * contain the color and alpha samples.
 250      * @return the mask array , which indicates which bits of the
 251      *         <code>int</code> pixel
 252      *         representation contain the color or alpha samples.
 253      */
 254     final public int[] getMasks() {
 255         return (int[]) maskArray.clone();
 256     }
 257 
 258     /*
 259      * A utility function to compute the mask offset and scalefactor,
 260      * store these and the mask in instance arrays, and verify that
 261      * the mask fits in the specified pixel size.
 262      */
 263     private void DecomposeMask(int mask,  int idx, String componentName) {
 264         int off = 0;
 265         int count = nBits[idx];
 266 
 267         // Store the mask
 268         maskArray[idx]   = mask;
 269 
 270         // Now find the shift
 271         if (mask != 0) {
 272             while ((mask & 1) == 0) {
 273                 mask >>>= 1;
 274                 off++;
 275             }




 235      * @return the mask, which indicates which bits of the <code>int</code>
 236      *         pixel representation contain the color or alpha sample specified
 237      *         by <code>index</code>.
 238      * @throws ArrayIndexOutOfBoundsException if <code>index</code> is
 239      *         greater than the number of components minus 1 in this
 240      *         <code>PackedColorModel</code> or if <code>index</code> is
 241      *         less than zero
 242      */
 243     final public int getMask(int index) {
 244         return maskArray[index];
 245     }
 246 
 247     /**
 248      * Returns a mask array indicating which bits in a pixel
 249      * contain the color and alpha samples.
 250      * @return the mask array , which indicates which bits of the
 251      *         <code>int</code> pixel
 252      *         representation contain the color or alpha samples.
 253      */
 254     final public int[] getMasks() {
 255         return maskArray.clone();
 256     }
 257 
 258     /*
 259      * A utility function to compute the mask offset and scalefactor,
 260      * store these and the mask in instance arrays, and verify that
 261      * the mask fits in the specified pixel size.
 262      */
 263     private void DecomposeMask(int mask,  int idx, String componentName) {
 264         int off = 0;
 265         int count = nBits[idx];
 266 
 267         // Store the mask
 268         maskArray[idx]   = mask;
 269 
 270         // Now find the shift
 271         if (mask != 0) {
 272             while ((mask & 1) == 0) {
 273                 mask >>>= 1;
 274                 off++;
 275             }