开发者

Constructing an IndexColourModel

I was wondering about constructing an IndexColourModel. I don't understand the 'bits' parameter argument. Is this what is used to index into a colour map, i.e. the number of least-significant-bits to use from the pixel to index into the map? The docs simply开发者_开发百科 state

bits - the number of bits each pixel occupies

I'm not satisfied with this and was wondering if someone could elucidate what exactly this parameter is and how it is used. Must this be correlated with the other 'size' parameter?


The bits parameter is the color depth.

From the IndexColourModel javadoc at the top of the class:

The values used to index into the colormap are taken from the least significant n bits of pixel representations where n is based on the pixel size specified in the constructor. For pixel sizes smaller than 8 bits, n is rounded up to a power of two (3 becomes 4 and 5,6,7 become 8). For pixel sizes between 8 and 16 bits, n is equal to the pixel size. Pixel sizes larger than 16 bits are not supported by this class. Higher order bits beyond n are ignored in pixel representations. Index values greater than or equal to the map size, but less than 2n, are undefined and return 0 for all color and alpha components.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜