Hi !
I have a strange problem when drawing a TImageList to a TBitmap
Canvas, where the TBitmap has PixelFormat pf24bit.
When the image from ImageList is drawn on positions 3, 7, 11 etc. to
the canvas, there is a RED line drawn on the canvas on the left side
! Desktop color depth is 16bit.
Why does this happen ? I guess ImageList works only with DDBs no
matter what, and doesn't support DIBSections... ?
I write a component, where I draw a transparent bitmap using
TImageList.
Everything is drawn on a TBitmap and then BitBlted to screen.
I need the 24-bit format, because I also work with ScanLine and the
RGB color components.
Here is the code:
Graphics::TBitmap *TmpImage, *FOriginal, *Buffer;
TImageList* pImageList;
...
//TmpImage is bmDDB
TRect R = Rect(0, 0, iWidth, iHeight);
TmpImage->Palette = CopyPalette(FOriginal->Palette);
TmpImage->Canvas->CopyRect(R, FOriginal->Canvas, R);
FTransparentColor = TmpImage->Canvas->Pixels[0][TmpImage->Height -
1];
pImageList->AddMasked(TmpImage, FTransparentColor);
...
Buffer->PixelFormat = pf24bit;
ImageList_DrawEx((HIMAGELIST)pImageList->Handle, iIndex,
Buffer->Canvas->Handle, 3, 0, 0, 0, clNone, clNone, ILD_TRANSPARENT);
BitBlt(Canvas->Handle, 0, 0, Buffer->Width, Buffer->Height,
Buffer->Canvas->Handle, 0, 0, SRCCOPY);
yields a red line on the left...
Regards
Petr Sulla