Hi,
So you need to separate RGB channels into three different offscreen bitmaps?
There is a method in TImageEnProc component:
GetRGBChannelAll(BitmapR,BitmapG,BitmapB:TIEBitmap);
Which will separate RGB channels from your original bitmap into 3 bitmaps.
I didn't use this method, but I assume that BitmapR, BitmapG and BitmapB
are 8-bit bitmaps.
// let's assume that your original bitmap in some ImageEnView is 24-bit bitmap.
TIEBitmap *bitmapR, *bitmapG, *bitmapB;
bitmapR = new TIEBitmap();
bitmapG = new TIEBitmap();
bitmapB = new TIEBitmap();
bitmapR->PixelFormat = bitmapG->PixelFormat = bitmapB->PixelFormat = ie8g;
// I'll set width and height, although I think it's not necessary,
// but in any case:
bitmapR->Width = bitmapG->Width = bitmapB->Width = ImageEnView->IEBitmap->Width;
bitmapR->Height = bitmapG->Height = bitmapB->Height = ImageEnView->IEBitmap->Height;
ImageView->Proc->GetRGBChannelAll(BitmapR, BitmapG, BitmapB);
Alternative approach is to scan through ImageEnView->IEBitmap channels.
The same way you've done it, but instead of:
for (y = 0; y < image->Picture->Bitmap->Height; y++)
{
p = (byte *) image->Picture->Bitmap->ScanLine[y];
...etc...
You have:
for (y = 0; y < ImageEnView->IEBitmap->Height; y++)
{
p = (byte *) ImageEnView->IEBitmap->ScanLine[y];
...etc...