Paint puts both "Bitmap" and "DIB Bitmap" on the clipboard.
At least WordPad "Paste Special" shows both after a Paint "Copy"
So I assume they are different things.
I see from what you said below that a CF-BITMAP can represent a handle to a
DIB so in that case I guess they'd be the same.
And you also said that a DIB includes a color table.
So, can I conclude that one difference between a DIB and a DDB is that the
DDB does not include a color table.
If you wanted to use a DDB you need to know the related color table
Also, even though WordPad shows both "Bitmap" and "DIB Bitmap" the
dataobject (DataO.GetFormats(False)) shows only the DIB. Why do you think
that is?
So, when you get a handle from the clipboard you don't know if it points to
a DDB or a DIB. Is that a problem?
Thanx
I'm going to search for DDB to see if I can learn more that way.
> So, can I conclude that one difference between a DIB and a DDB is that the
> DDB does not include a color table.
A DDB is optimized for your Display Driver's current bit depth.
If that depth is 32bpp or 16bpp, then no palette is necessary. If your
Display's depth is 8bpp then a palette is necessary.
> So, when you get a handle from the clipboard you don't know if it points
> to a DDB or a DIB. Is that a problem?
It is easy to test what the HBITMAP represents. Use GDI GetObject with
DIBSECTION.
If the return is sizeof(DIBSECTION) then it is a DIB. If not it is a DDB.
> Also, even though WordPad shows both "Bitmap" and "DIB Bitmap" the
> dataobject (DataO.GetFormats(False)) shows only the DIB. Why do you think
> that is?
The CF_BITMAP and CF_DIB formats are synthesized by the clipboard when the
application that
places one format but not the other on the clipboard.
You can always retrieve the synthesized formats. Use GetFormats(True).
> Paint puts both "Bitmap" and "DIB Bitmap" on the clipboard.
> At least WordPad "Paste Special" shows both after a Paint "Copy"
[quoted text clipped - 61 lines]
>>>
>>> Thanx for any help
Frank - 20 Aug 2007 17:08 GMT
If you can, one more question.
I found CreateCompatibleBitmap which can be used to create a DDB.
And CreateCompatibleDC which can be used to write on it.
I know this is an academic question but where is the color table (if there
is one).
I'd guess it's in the CompatibleDC.
Thanks
>> So, can I conclude that one difference between a DIB and a DDB is that
>> the DDB does not include a color table.
[quoted text clipped - 87 lines]
>>>>
>>>> Thanx for any help
Michael Phillips, Jr. - 20 Aug 2007 18:03 GMT
> I found CreateCompatibleBitmap which can be used to create a DDB.
> And CreateCompatibleDC which can be used to write on it.
> I know this is an academic question but where is the color table (if there
> is one).
CreateCompatibleBitmap creates an empty bitmap of the width and height of
your choice optimized for the current Display's bit depth.
If your Display is set for 16bpp or 32bpp, then there is no color table.
> I'd guess it's in the CompatibleDC.
It contains whatever palette that was selected into it.
GetCurrentPalette will provide you with the palette currently selected into
the device context.
If your display depth is 8bpp, then you must create, select and realize a
palette before you can render to the empty indexed bitmap.
> If you can, one more question.
>
[quoted text clipped - 98 lines]
>>>>>
>>>>> Thanx for any help
Frank - 20 Aug 2007 18:31 GMT
Great answers.
Thanx
>> I found CreateCompatibleBitmap which can be used to create a DDB.
>> And CreateCompatibleDC which can be used to write on it.
[quoted text clipped - 117 lines]
>>>>>>
>>>>>> Thanx for any help