c++builder中图像处理问题
[code=C/C++][/code] LOGPALETTE* pPalette;
pPalette = (LOGPALETTE*)new char [sizeof(LOGPALETTE)+
sizeof(PALETTEENTRY)*256];
pPalette->palVersion = 0x300;
pPalette->palNumEntries = 256;
for(int i = 0;i < 256; ++i)
{
pPalette->palPalEntry[i].peRed = (short) i;
pPalette->palPalEntry[i].peGreen = (short)i;
pPalette->palPalEntry[i].peBlue = (short)i;
pPalette->palPalEntry[i].peFlags = PC_RESERVED;
}
pBitmap->Palette = ::CreatePalette(pPalette);
ImageGrayscale->Canvas->Draw(0,0,pBitmap);
delete[] pPalette;
我不明白为什么pPalette->palPalEntry[i].peRed = (short) i;都赋值i 不是应该赋读取的值吗
求大神解答
[解决办法]
想把彩色图像转换成灰度图像?直接转换像素比较好