< prev index next >

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

Print this page




  38  * optional alpha components corresponding to each index.  All components
  39  * are represented in the colormap as 8-bit unsigned integral values.
  40  * Some constructors allow the caller to specify "holes" in the colormap
  41  * by indicating which colormap entries are valid and which represent
  42  * unusable colors via the bits set in a {@code BigInteger} object.
  43  * This color model is similar to an X11 PseudoColor visual.
  44  * <p>
  45  * Some constructors provide a means to specify an alpha component
  46  * for each pixel in the colormap, while others either provide no
  47  * such means or, in some cases, a flag to indicate whether the
  48  * colormap data contains alpha values.  If no alpha is supplied to
  49  * the constructor, an opaque alpha component (alpha = 1.0) is
  50  * assumed for each entry.
  51  * An optional transparent pixel value can be supplied that indicates a
  52  * pixel to be made completely transparent, regardless of any alpha
  53  * component supplied or assumed for that pixel value.
  54  * Note that the color components in the colormap of an
  55  * {@code IndexColorModel} objects are never pre-multiplied with
  56  * the alpha components.
  57  * <p>
  58  * <a name="transparency">
  59  * The transparency of an {@code IndexColorModel} object is
  60  * determined by examining the alpha components of the colors in the
  61  * colormap and choosing the most specific value after considering
  62  * the optional alpha values and any transparent index specified.
  63  * The transparency value is {@code Transparency.OPAQUE}
  64  * only if all valid colors in
  65  * the colormap are opaque and there is no valid transparent pixel.
  66  * If all valid colors
  67  * in the colormap are either completely opaque (alpha = 1.0) or
  68  * completely transparent (alpha = 0.0), which typically occurs when
  69  * a valid transparent pixel is specified,
  70  * the value is {@code Transparency.BITMASK}.
  71  * Otherwise, the value is {@code Transparency.TRANSLUCENT}, indicating
  72  * that some valid color has an alpha component that is
  73  * neither completely transparent nor completely opaque
  74  * (0.0 &lt; alpha &lt; 1.0).
  75  * </a>
  76  *
  77  * <p>
  78  * If an {@code IndexColorModel} object has
  79  * a transparency value of {@code Transparency.OPAQUE},
  80  * then the {@code hasAlpha}
  81  * and {@code getNumComponents} methods
  82  * (both inherited from {@code ColorModel})
  83  * return false and 3, respectively.
  84  * For any other transparency value,
  85  * {@code hasAlpha} returns true
  86  * and {@code getNumComponents} returns 4.
  87  *
  88  * <p>
  89  * <a name="index_values">
  90  * The values used to index into the colormap are taken from the least
  91  * significant <em>n</em> bits of pixel representations where
  92  * <em>n</em> is based on the pixel size specified in the constructor.
  93  * For pixel sizes smaller than 8 bits, <em>n</em> is rounded up to a
  94  * power of two (3 becomes 4 and 5,6,7 become 8).
  95  * For pixel sizes between 8 and 16 bits, <em>n</em> is equal to the
  96  * pixel size.
  97  * Pixel sizes larger than 16 bits are not supported by this class.
  98  * Higher order bits beyond <em>n</em> are ignored in pixel representations.
  99  * Index values greater than or equal to the map size, but less than
 100  * 2<sup><em>n</em></sup>, are undefined and return 0 for all color and
 101  * alpha components.
 102  * </a>
 103  * <p>
 104  * For those methods that use a primitive array pixel representation of
 105  * type {@code transferType}, the array length is always one.
 106  * The transfer types supported are {@code DataBuffer.TYPE_BYTE} and
 107  * {@code DataBuffer.TYPE_USHORT}.  A single int pixel
 108  * representation is valid for all objects of this class, since it is
 109  * always possible to represent pixel values used with this class in a




  38  * optional alpha components corresponding to each index.  All components
  39  * are represented in the colormap as 8-bit unsigned integral values.
  40  * Some constructors allow the caller to specify "holes" in the colormap
  41  * by indicating which colormap entries are valid and which represent
  42  * unusable colors via the bits set in a {@code BigInteger} object.
  43  * This color model is similar to an X11 PseudoColor visual.
  44  * <p>
  45  * Some constructors provide a means to specify an alpha component
  46  * for each pixel in the colormap, while others either provide no
  47  * such means or, in some cases, a flag to indicate whether the
  48  * colormap data contains alpha values.  If no alpha is supplied to
  49  * the constructor, an opaque alpha component (alpha = 1.0) is
  50  * assumed for each entry.
  51  * An optional transparent pixel value can be supplied that indicates a
  52  * pixel to be made completely transparent, regardless of any alpha
  53  * component supplied or assumed for that pixel value.
  54  * Note that the color components in the colormap of an
  55  * {@code IndexColorModel} objects are never pre-multiplied with
  56  * the alpha components.
  57  * <p>
  58  * <a id="transparency">
  59  * The transparency of an {@code IndexColorModel} object is
  60  * determined by examining the alpha components of the colors in the
  61  * colormap and choosing the most specific value after considering
  62  * the optional alpha values and any transparent index specified.
  63  * The transparency value is {@code Transparency.OPAQUE}
  64  * only if all valid colors in
  65  * the colormap are opaque and there is no valid transparent pixel.
  66  * If all valid colors
  67  * in the colormap are either completely opaque (alpha = 1.0) or
  68  * completely transparent (alpha = 0.0), which typically occurs when
  69  * a valid transparent pixel is specified,
  70  * the value is {@code Transparency.BITMASK}.
  71  * Otherwise, the value is {@code Transparency.TRANSLUCENT}, indicating
  72  * that some valid color has an alpha component that is
  73  * neither completely transparent nor completely opaque
  74  * (0.0 &lt; alpha &lt; 1.0).
  75  * </a>
  76  *
  77  * <p>
  78  * If an {@code IndexColorModel} object has
  79  * a transparency value of {@code Transparency.OPAQUE},
  80  * then the {@code hasAlpha}
  81  * and {@code getNumComponents} methods
  82  * (both inherited from {@code ColorModel})
  83  * return false and 3, respectively.
  84  * For any other transparency value,
  85  * {@code hasAlpha} returns true
  86  * and {@code getNumComponents} returns 4.
  87  *
  88  * <p>
  89  * <a id="index_values">
  90  * The values used to index into the colormap are taken from the least
  91  * significant <em>n</em> bits of pixel representations where
  92  * <em>n</em> is based on the pixel size specified in the constructor.
  93  * For pixel sizes smaller than 8 bits, <em>n</em> is rounded up to a
  94  * power of two (3 becomes 4 and 5,6,7 become 8).
  95  * For pixel sizes between 8 and 16 bits, <em>n</em> is equal to the
  96  * pixel size.
  97  * Pixel sizes larger than 16 bits are not supported by this class.
  98  * Higher order bits beyond <em>n</em> are ignored in pixel representations.
  99  * Index values greater than or equal to the map size, but less than
 100  * 2<sup><em>n</em></sup>, are undefined and return 0 for all color and
 101  * alpha components.
 102  * </a>
 103  * <p>
 104  * For those methods that use a primitive array pixel representation of
 105  * type {@code transferType}, the array length is always one.
 106  * The transfer types supported are {@code DataBuffer.TYPE_BYTE} and
 107  * {@code DataBuffer.TYPE_USHORT}.  A single int pixel
 108  * representation is valid for all objects of this class, since it is
 109  * always possible to represent pixel values used with this class in a


< prev index next >