What is a Bitmap's memory layout?

  • Thread starter Thread starter \Frank\
  • Start date Start date
F

\Frank\

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 the case, is a clipboard's Bitmap layout always related to the
screen?



Thanx
 
Hi,

A bitmap is just that, a map of bits

Each pixel is represented by a given number of bytes (Depending of the
resolution) and they are row after row.

Is that enuogh?
 
Frank said:
On the Internet there are many descriptions of the memory layout for a DIB.

But none that I can find for a Bitmap.

Do you mean the System.Drawing.Bitmap class?

If so, use the LockBits method to access the image data. It provides you
with a BitmapData object that contains the information you need to
access the data. You don't have to bother about details of the memory
layout, like if it's stored top-down or bottom-up.
Is that because a Bitmap's layout depends on a related device.

What related device? The layout depends on the pixel format of the bitmap.
If that's the case, is a clipboard's Bitmap layout always related to the
screen?

Why would it be? Any program can place a Bitmap in the clipboard, so the
format would be decided by the program.
 
I meant the Windows Bitmap
I did find the description of how to save a Windows GDI Bitmap on a file and
it's the same as that for saving a DIB.

But often I see on the Clipboard "Bitmap" as well as "DIB Bitmap"
There is also CF_Bitmap and CF_DIB

Are they really saved the same on a file?

What is the difference between what is retrieved from a Bitmap (CF_Bitmap)
and a DIB(CF_DIB) from the clipboard?


Thanx


Added "pointed to by HBITMAP"
 
I meant the Windows Bitmap
I did find the discription of how to save a Windows GDI Bitmap on a file and
it's the same as that for saving a DIB.

But often I see on the Clipboard "Bitmap" as well as "DIB Bitmap"
There is also CF_Bitmap and CF_DIB

Are they really saved the same on a file?

What is the difference between what is retrieved from a Bitmap (CF_Bitmap)
and a DIB(CF_DIB) from the clipboard?


Thanx
 
Frank said:
I meant the Windows Bitmap

There are several different ways of representing a bitmap, both in
memory and as files.
I did find the description of how to save a Windows GDI Bitmap on a file and
it's the same as that for saving a DIB.

That's not surprising. A GDI Bitmap can't be saved as a useful format,
so you save a GDI Bitmap in DIB format.
But often I see on the Clipboard "Bitmap" as well as "DIB Bitmap"
There is also CF_Bitmap and CF_DIB

The clipboard format values all start with CF_, so "Bitmap" and "DIB
Bitmap" are only descriptions of the formats.

MSDN: Clipboard Formats:
http://msdn2.microsoft.com/en-us/library/ms649013.aspx
Are they really saved the same on a file?

What is the difference between what is retrieved from a Bitmap (CF_Bitmap)
and a DIB(CF_DIB) from the clipboard?

CF_BITMAP is a handle to a bitmap object. CF_DIB is a DIB bitmap object.
You can retrieve any of those as either of those, as the system can
convert between them.
 
CF_BITMAP is a handle to a bitmap object.

I'm having trouble phrasing my question because of lack of background.

But given the above handle, assuming I can use it to get an object from the
clipboard. what is that object like?

Is it a DDB that is oriented to the screen?

Or something else?



Thanks for staying with me on this
 
If I do a Save in "Paint" and then click "Paste Special" in wordpad I see
that the clipboard has a "Bitmap Image"on it and a "Device Independent
Bitmap" on it.

Can it be that no one has wondered what is different about these two items?

I know one is placed/retrieved with CF_DIB and the other is placed/retrieved
with CF_Bitmap.

Therefore there definitions must pre-date DotNet.

So what are they. The DIB memory layout is well documented. But what low
level stuff do we know about the other item?


I'd appreciate any helpful info.


Thanx
 
Back
Top