我想知道如何构建一个 IndexColourModel 。我不明白“位”参数参数。这是用于索引颜色图的内容,即从像素中使用的最低有效位的数量来索引图?该文档只是说明
bits - the number of bits each pixel occupies
我对此不满意,想知道是否有人可以阐明这个参数到底是什么以及它是如何使用的。这必须与其他“大小”参数相关吗?
最佳答案
位参数是 color depth .
来自IndexColourModel javadoc 位于类的顶部:
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.
关于java - 构建 IndexColorModel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6945965/