[lazarus] Bitmap transparency?
Micha Nelissen
M.Nelissen at student.tue.nl
Wed Nov 12 15:02:14 EST 2003
Mattias Gaertner wrote:
> On Wed, 12 Nov 2003 20:31:08 +0100
> Micha Nelissen <M.Nelissen at student.tue.nl> wrote:
>
>>Let me first say: the color format I mean is the RRGGBBAA and how bits
>>each take.
>>
>>Yes. But the winapi can convert between color formats automatically. You
>>give the win32 interface a color format, and it can pass it on to the
>>winapi for processing.
>
>
> Yes. But every conversion reduces the quality, so we should try to find the
> current format.
Agreed, but when you have the right number of bits, it's not so bad
anymore, right?
>>>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?
>>
>>The BITMAPINFO is contained with a DIBSECTION. The DIBSECTION can only
>>be retrieved for device independant bitmaps, that means, bitmaps created
>>by CreateDIBSection. No other function returns a BITMAPINFO structure.
>>
>>The BITMAP structure can always be retrieved from any bitmap. But it
>>doesn't contain the information to fill in {red,blue,green}{shift,prec}.
>
>
> AFAIK the INFOHEADER does. See for example
> http://astronomy.swin.edu.au/~pbourke/dataformats/bmp/.
I was not completely correct indeed. The DIBSECTION contains a
BITMAPINFOHEADER. BITMAPINFO also contains the BITMAPINFOHEADER. If the
BITMAPINFOHEADER.biCompression is BI_BITFIELDS, then and only then does
BITMAPINFO.
Yes, but they are reading from disk. An in-memory bitmap, ie an HBITMAP
handle, is different.
Ah I think found something finally:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=36B74D1B.E74A1F2A%40spamsucksaros.net&rnum=2&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3DHBITMAP%2BBITMAPINFO%26sa%3DN%26tab%3Dwg
http://www.users.cts.com/sd/m/menright/display.html
http://support.microsoft.com/default.aspx?scid=kb;en-us;195829
>>>>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?
>>
>>I am able to get the color depth and bits per pixel used, eg. 16, 24, 32
>>bits.
>
>
> I guess, win32 also defines, what bits are the red, green and blue?
It does not by default :(. The BITMAPINFO structure only suggests what
'defaults' are supported by windows 95.
Micha.
More information about the Lazarus
mailing list