Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / August 2007

Tip: Looking for answers? Try searching our database.

What is a Bitmap

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank - 20 Aug 2007 02:35 GMT
I trying to learn what a Bitmap is. Not a Managed Bitmap Object but one
that, for example, comes from the clipboard with CF_BITMAP.

I'm guessing that a CompatableBitmap is an array of indices that point to
the colors in a Palette of the display driver.

So if I get a bitmap via CF_BITMAP I need to also get a Palette off the
clipboard and realize it then display the bitmap.

I believe "Realize it" means to put it into the display driver.

Is any of the above correct?

Can you say it better - I'm really guessing at the terminology.

Thanx for any help
Michael Phillips, Jr. - 20 Aug 2007 15:15 GMT
> So if I get a bitmap via CF_BITMAP I need to also get a Palette off the
> clipboard and realize it then display the bitmap.

The CF_BITMAP represents an HBITMAP handle to a GDI Bitmap.

That bitmap handle can be a DIB or a DDB(i.e., Device Independent or Device
Dependent ).

If the bitmap is indexed, you need to retrieve the CF_PALETTE from the
clipboard.

The CF_PALETTE is a handle to a GDI Palette.

You also have the option to avoid retrieving the palette of an indexed
bitmap by
requesting a CF_DIB from the clipboard.  The CF_DIB is a Global Memory
Handle
that represents a Device Independent Bitmap which alread includes the color
table, if present.

The clipboard always synthesizes this format regardless if the original
application placed the CF_DIB
on the clipboard.

>I trying to learn what a Bitmap is. Not a Managed Bitmap Object but one
>that, for example, comes from the clipboard with CF_BITMAP.
[quoted text clipped - 12 lines]
>
> Thanx for any help
Frank - 20 Aug 2007 16:03 GMT
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 if I get a bitmap via CF_BITMAP I need to also get a Palette off the
>> clipboard and realize it then display the bitmap.
[quoted text clipped - 36 lines]
>>
>> Thanx for any help
Michael Phillips, Jr. - 20 Aug 2007 16:26 GMT
> 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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.