473,378 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

What is a Bitmap

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
Aug 20 '07 #1
6 2419
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.

""Frank"" <Fr***@a-znet.comwrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl...
>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


Aug 20 '07 #2
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.

"Michael Phillips, Jr." <mp*********@nospam.jun0.c0mwrote in message
news:e4**************@TK2MSFTNGP04.phx.gbl...
>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.

""Frank"" <Fr***@a-znet.comwrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl...
>>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



Aug 20 '07 #3
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).

""Frank"" <Fr***@a-znet.comwrote in message
news:um**************@TK2MSFTNGP06.phx.gbl...
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.

"Michael Phillips, Jr." <mp*********@nospam.jun0.c0mwrote in message
news:e4**************@TK2MSFTNGP04.phx.gbl...
>>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.

""Frank"" <Fr***@a-znet.comwrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl...
>>>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




Aug 20 '07 #4
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
"Michael Phillips, Jr." <mp*********@nospam.jun0.c0mwrote in message
news:uU*************@TK2MSFTNGP05.phx.gbl...
>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).

""Frank"" <Fr***@a-znet.comwrote in message
news:um**************@TK2MSFTNGP06.phx.gbl...
>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.

"Michael Phillips, Jr." <mp*********@nospam.jun0.c0mwrote in message
news:e4**************@TK2MSFTNGP04.phx.gbl...
>>>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.

""Frank"" <Fr***@a-znet.comwrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl...
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




Aug 20 '07 #5
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.

""Frank"" <Fr***@a-znet.comwrote in message
news:uz**************@TK2MSFTNGP03.phx.gbl...
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
"Michael Phillips, Jr." <mp*********@nospam.jun0.c0mwrote in message
news:uU*************@TK2MSFTNGP05.phx.gbl...
>>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).

""Frank"" <Fr***@a-znet.comwrote in message
news:um**************@TK2MSFTNGP06.phx.gbl...
>>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.

"Michael Phillips, Jr." <mp*********@nospam.jun0.c0mwrote in message
news:e4**************@TK2MSFTNGP04.phx.gbl...
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.

""Frank"" <Fr***@a-znet.comwrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl...
>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
>
>




Aug 20 '07 #6
Great answers.

Thanx

"Michael Phillips, Jr." <mp*********@nospam.jun0.c0mwrote in message
news:es**************@TK2MSFTNGP02.phx.gbl...
>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.

""Frank"" <Fr***@a-znet.comwrote in message
news:uz**************@TK2MSFTNGP03.phx.gbl...
>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
"Michael Phillips, Jr." <mp*********@nospam.jun0.c0mwrote in message
news:uU*************@TK2MSFTNGP05.phx.gbl...
>>>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).

""Frank"" <Fr***@a-znet.comwrote in message
news:um**************@TK2MSFTNGP06.phx.gbl...
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.

"Michael Phillips, Jr." <mp*********@nospam.jun0.c0mwrote in message
news:e4**************@TK2MSFTNGP04.phx.gbl...
>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.
>
""Frank"" <Fr***@a-znet.comwrote in message
news:OT**************@TK2MSFTNGP02.phx.gbl.. .
>>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
>>
>>
>
>




Aug 20 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steve S | last post by:
First heres the process... - Draw bitmap - Draw text to it - Save Bitmap - Print Bitmap Now, if I place this inside the PrintPage event, program either freezes or causes arthmetic errors (on...
2
by: Sharon | last post by:
I encountered a strange behavior when doing ‘new Bitmap’: The following code works fine and the given bitmap file is shown on the PictureBox (the m_DrawArea) in the correct bitmap sizes: ...
2
by: active | last post by:
I find Bitmap.Save works for WMF files but Bitmap.FromFile does not. If I use FromFile on a WMF file that came with VS I get an exception. If I use it on a WMF file created with Bitmap.Save I...
4
by: vbdotnetmania | last post by:
I have the following snippet of code with bm being a succesfully stored bitmap (not including all the code just the relevant bits) Dim g As Graphics Dim g2 As Graphics Dim bm As Bitmap Dim bm2...
6
by: \Frank\ | last post by:
On the Internet there are many descriptions of the memory layout for a DIB. But none that I can find for a Bitmap. Is that because a Bitmap's layout depends on a related device. If that's...
2
by: Peter Oliphant | last post by:
I want to create a new Bitmap which is a portion of an existing Bitmap. For example, if I have a Bitmap that is 100x100 in size I might want to create a new Bitmap that is equivalent to the one...
5
by: =?Utf-8?B?QVRU?= | last post by:
I have a bitmap of 100X100. On the load, the bitmap is created by a function (createimage()). On my OnPaint, I draw the image back to the screen (e.Graphics.DrawImage( bitmap, destrect)). Now,...
6
by: raphfrk | last post by:
While I am here, I just thought I'd ask if there is a recommended way of handling 2d dynamic arrays. I implement them using the following kind of code. ...
0
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Using VS2005 with .NET Framework 2.0 I'm using the the System.Windows.Forms.PictureBox to display a bitmap when the PictureBox.SizeMode is PictureBoxSizeMode.StretchImage The PictureBox can be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.