C********g 发帖数: 1548 | 1 我有一段Java程序,如下。我想请问,对于rgb,为什么不用单个数值,而是用一个256
长度的数组?
static IndexColorModel getLUTColorModel( )
{
byte[] r = new byte[ 256 ];
byte[] g = new byte[ 256 ];
byte[] b = new byte[ 256 ];
// fill in the r,g, and b arrays with a ramp or 0
for ( int i = 0; i < 256 ; i++ ){
r[i] = (byte) i;
g[i] = (byte) i;
b[i] = (byte) i;
}
return new IndexColorModel( 8, 256, r, g, b );
} | A***l 发帖数: 461 | 2 查一下RBG配色表,这个是标准定义,色阶。
256
【在 C********g 的大作中提到】 : 我有一段Java程序,如下。我想请问,对于rgb,为什么不用单个数值,而是用一个256 : 长度的数组? : static IndexColorModel getLUTColorModel( ) : { : byte[] r = new byte[ 256 ]; : byte[] g = new byte[ 256 ]; : byte[] b = new byte[ 256 ]; : // fill in the r,g, and b arrays with a ramp or 0 : for ( int i = 0; i < 256 ; i++ ){ : r[i] = (byte) i;
|
|