问题是使用了Picture控件,具体处理的是什么图片不清楚,没得测试。
重点是Picture像素的颜色数值,这与单纯的“颜色”数值是两回事。
常见的BITMAP像素位数有1、4、8、16、24或32(bit),1、4、8时用一个颜色表来描述像素的颜色,分别是2、16、256个表项,通过索引号获取颜色值;> 8 时,没有颜色表项。
像素颜色定义的数据结构
程序代码:
typedef struct _RGB1bit_
{
unsigned char index0:1;
unsigned char index1:1;
unsigned char index2:1;
unsigned char index3:1;
unsigned char index4:1;
unsigned char index5:1;
unsigned char index6:1;
unsigned char index7:1;
} RGB1bit, *PRGB1bit;
typedef struct _RGB4bit_
{
unsigned char index0:4;
unsigned char index1:4;
} RGB4bit, *PRGB4bit;
typedef struct _RGB8bit_
{
unsigned char index;
} RGB8bit, *PRGB8bit;
typedef struct _RGB16bit_
{
union _RGB_
{
struct _RGB555_
{
unsigned short int N:1;
unsigned short int B:5;
unsigned short int G:5;
unsigned short int R:5;
} RGB555;
struct _RGB565_
{
unsigned short int B:5;
unsigned short int G:6;
unsigned short int R:5;
} RGB565;
} RGB;
} RGB16bit, *PRGB16bit;
typedef struct _RGB24bit_
{
unsigned char B;
unsigned char G;
unsigned char R;
} RGB24bit, *PRGB24bit;
typedef struct _RGB32bit_
{
unsigned char B;
unsigned char G;
unsigned char R;
unsigned char A;
} RGB32bit, *PRGB32bit;