[lazarus] Bitmap transparency?
Micha Nelissen
M.Nelissen at student.tue.nl
Mon Nov 10 07:06:40 EST 2003
Micha Nelissen wrote:
> Mattias Gaertner wrote:
>
>>
>> Sounds like what we want. With the information in the RawImage
>> description
>> the data created already matches the color format. The interface only
>> needs
>> to setup the header.
>> The idea is to implement "CreateCompatibleBitmap" in a platform
>> independent
>> way.
>> Under win32 afaik you would normally use CreateCompatibleBitmap to
>> create a
>> bitmap.
>
>
> The 'compatible' in CreateCompatibleBitmap means compatible to some DC.
> With the current 5 fpimage functions, this function cannot be used,
> because I don't know what DC to create a compatible bitmap to.
It's even worse. When no DC is available to create a compatible bitmap
with, CreateBitmap has to be used, we knew this. But now I found this on
the internet:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=OsQ0iiDP%24GA.236%40cppssbbsa04&rnum=3&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dwin32%2Bcreatebitmap%2Bmemory%26btnG%3DGoogle%2BSearch
---
Don't use CreateBitmap, use CreateDIBitmap or CreateCompatibleBitmap.
CreateDIBitmap & CreateCompatibleBitmap both will create a bitmap that
is guaranteed to be compatible (ie can be blitted to) with the screen.
In addition, CreateDIBitmap takes a pointer to a device independent
bitmap (ie the data contained within a .bmp file).
CreateBitmap on the other hand will create the bitmap you specify, but
if the cPlanes and cBitsPerPel settings do not match the current display
settings the bitmap can not be blitted to the display.
---
So it's not even guaranteed to work :(. FYI: CreateDIBitmap,
CreateCompatibleBitmap both need a DC.
Micha.
More information about the Lazarus
mailing list