[lazarus] Bitmap transparency?

Micha Nelissen M.Nelissen at student.tue.nl
Wed Nov 12 03:14:32 EST 2003

Mattias Gaertner wrote:

> On Mon, 10 Nov 2003 08:07:09 +0100
> Micha Nelissen <M.Nelissen at student.tue.nl> wrote:
>>I think I can fill the RawImageDesc fields except palette, and I don't 
>>know what to do with RedPrec, RedShift, etc..
> You need to find out the color format of the device/bitmap for this.

Sorry I keep nagging about this subject, but:
1) there is one function not needing a DC to create a bitmap, 
'CreateBitmap'. It is not possible to retrieve color format of this 
bitmap. Even a google search did not turn up anything on the color 
format subject. I guess, nobody uses it.
2) the functions that do have information on color format also need a 
DC. You create a device independant bitmap with CreateDIBSection, and a 
device dependant one with CreateDIBitmap. Long live the winapi, logic is 
nowhere to be found it seems! The names are very unlogical.
3) there is no function to retrieve the color format of a device. One 
can only guess at it, based on BITMAPINFO structure help. That's because 
the winapi support converting the color formats on the fly. For example, 
using CreateDIBitmap, you specify the color format your source bitmap is 
in, and the winapi will convert it to the color format of the target 
device. It seems logical that one would be able to retrieve the color 
format of the device for fast rendering and stuff, but it just seems 
impossible. I think that's the reason why in delphi there is a pfDevice 
for TPixelFormat.

Any tips? Shall I return a default color format in the raw image?



More information about the Lazarus mailing list