java - 构建 IndexColorModel

标签 java png java-2d color-palette

我想知道如何构建一个 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/

相关文章:

java - "Not enough storage is avaliable to process this command"

java - JFrame 中心组件

.net - 以编程方式选择图像转换格式为 JPEG 或 PNG 以用于 Silverlight 显示

windows - Windows XP SP3(XP 模式 Windows 7)上 Tbutton 中的 Nasty Png

java - 将 ACM 图形窗口转换为图像文件

java - 使用 java 的 2D 模拟器的合适平台

java - 如何在来自两个不同类的 JFrame 中将两个圆圈一起移动

java - 框架中应有红色矩形,但什么也看不到

用于数据分析的 Java Web 平台

java - Android 应用程序启动缓慢,但启动缓慢后运行良好