处理8位灰度图像显示编码:
灰色编码
for(int i=0;i<256;i++)
{
pColorTable[i].rgbBlue=i;
pColorTable[i].rgbGreen=i;
pColorTable[i].rgbRed=i;
pColorTable[i].rgbReserved=0;
}
红色饱和度编码
for(int i=0;i<256;i++)
{
pColorTable[i].rgbBlue=0;
pColorTable[i].rgbGreen=0;
pColorTable[i].rgbRed=i;
pColorTable[i].rgbReserved=0;
}
绿色饱和度编码
for(int i=0;i<256;i++)
{
pColorTable[i].rgbBlue=0;
pColorTable[i].rgbGreen=i;
pColorTable[i].rgbRed=0;
pColorTable[i].rgbReserved=0;
}
蓝色饱和度编码
for(int i=0;i<256;i++)
{
pColorTable[i].rgbBlue=i;
pColorTable[i].rgbGreen=0;
pColorTable[i].rgbRed=0;
pColorTable[i].rgbReserved=0;
}
黄色饱和度编码
for(int i=0;i<256;i++)
{
pColorTable[i].rgbBlue=0;
pColorTable[i].rgbGreen=i;
pColorTable[i].rgbRed=i;
pColorTable[i].rgbReserved=0;
}
逆灰度编码
for(int i=0;i<256;i++)
{
pColorTable[i].rgbBlue=255-i;
pColorTable[i].rgbGreen=255-i;
pColorTable[i].rgbRed=255-i;
pColorTable[i].rgbReserved=0;
}
紫色饱和度编码
for(int i=0;i<256;i++)
{
pColorTable[i].rgbBlue=i;
pColorTable[i].rgbGreen=0;
pColorTable[i].rgbRed=i;
pColorTable[i].rgbReserved=0;
}
青色饱和度编码
for(int i=0;i<256;i++)
{
pColorTable[i].rgbBlue=i;
pColorTable[i].rgbGreen=i;
pColorTable[i].rgbRed=0;
pColorTable[i].rgbReserved=0;
}
热金属编码
for(int i=0;i<256;i++)
{
if(i<64)
{
pColorTable[i].rgbBlue=4*i;
pColorTable[i].rgbGreen=0;
pColorTable[i].rgbRed=0;
}
else
if(i<128)
{
pColorTable[i].rgbBlue=(i<96)? 255:225-8*(i-95);
pColorTable[i].rgbGreen=0;
pColorTable[i].rgbRed=4*(i-64);
}
else
if(i<192)
{
pColorTable[i].rgbBlue=0;
pColorTable[i].rgbGreen=4*(i-192);
pColorTable[i].rgbRed=255;
}
else
{
pColorTable[i].rgbBlue=4*(i-192);
pColorTable[i].rgbGreen=255;
pColorTable[i].rgbRed=255;
}
pColorTable[i].rgbReserved=0;
}
彩虹编码
for(int i=0;i<256;i++)
{
if(i<64)
{
pColorTable[i].rgbBlue=(i<32)? 8*i-1:255;
pColorTable[i].rgbGreen=(i<32)? 0:8*(i-32);
pColorTable[i].rgbRed=0;
}
else
if(i<128)
{
pColorTable[i].rgbBlue=(i<96)?255-8*(i-64):0;
pColorTable[i].rgbGreen=255;
pColorTable[i].rgbRed=(i<96)?0:8*(i-96);
}
else
if(i<192)
{
pColorTable[i].rgbBlue=0;
pColorTable[i].rgbGreen=255-4*(i-128);
pColorTable[i].rgbRed=255;
}
else
{
pColorTable[i].rgbBlue=0;
pColorTable[i].rgbGreen=4*(i-192);
pColorTable[i].rgbRed=255;
}
pColorTable[i].rgbReserved=0;
}