[lazarus] Bitmap transparency?
Mattias Gaertner
nc-gaertnma at netcologne.de
Wed Nov 12 14:08:11 EST 2003
On Wed, 12 Nov 2003 09:23:06 +0100
Micha Nelissen <M.Nelissen at student.tue.nl> wrote:
> 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.
Ok. So, under win32 it seems, it is up to the user to keep book of the
format of a DC/bitmap. But this data is win32 specific, so the LCL user
can't do it. It must be done, by the win32 intf. Right?
> 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.
Hardly believable.
Can this BITMAPINFO only retrieved from bitmaps or can you create a bitmap
fom any device and get a BTMAPINFO? And with this, get the color format from
any DC?
> 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?
Yes. I guess, at least the screen resolution can be retrieved, can't it?
Mattias
More information about the Lazarus
mailing list