TBitmap, TImageList and pf24bit problem

TBitmap, TImageList and pf24bit problem

Post by Petr Sul » Thu, 14 Feb 2002 18:42:39



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

 
 
 

1. pf24Bit problems .....

Hi, i tried a simple example program of ScanLine and pf24Bit and
all this nice stuff, i created a TBitmap buffer with the "new"
command and then i loaded the image "clouds.bmp" into it and
then i used ScanLine to scan all the pixels and change their
values and then i showed the result on a canvas, as it is, the
program rum very nice and show me the image after the changes,
but if i change the pf24Bit to pf8Bit or to pf16Bit then i get
some kine of a runtime error, i don't remember now what was the
error or on which line, it was on my computer at work.

Does anyone have an idea what this error can be?

Thanks :-)

Ruby.

2. Grids and Rulers

3. Strange problem with TImageList

4. Text stuff

5. TimageList (Problem);

6. DirectX D

7. TImageList Problem - Please Help

8. Would ya believe .....

9. Resolution Problems with TImageList

10. invisble Timagelist problems

11. Problems with TImageList

12. TImageList->GetResource problems...

13. TimageList problem