can someone explain the definition of DDB and DIB?

Win32 Programming


  • 1. BitBlt(,,,,,,,,dwRop)
    Env: VC++6.00 I am making bitmap(8bit depth DIB format) pasting operation from clipboard to my app. One of pasting mode I need is as follows, only these positions whose color = 0 on destination bitmap will be changed by source bitmap(here is clipboard). That is to say, if color != 0, color will keep unchanged. Can I do that by BitBlt(,,,,,,,,dwRop)? If yes, how should I set dwRop parameter? TIA William
  • 2. draw png with GDI+
    hi, all. i make a png file with photoshop9. But the size of image on screen is bigger than the size in fact. who can talk me the reason. thanks. kuolei
  • 3. GDI + and XORing lines
    C++ ver.6 SP6 Platform SDK Feb 2003 No MDF Is nobody able to answer my previous question about copying an image from a DC to an Image or Bitmap object? I have another question ... The second thing I tried to do is XOR a line so that I could XOR it a second time to erase it. This was done in GDI by using SetROP2(). Im my case, I want to use it for drawing a line that's fixed at one end, and is drawn to the cursor, updating the line as the cursor moves. Is there a way to do this in GDI+ ? -- Ron

can someone explain the definition of DDB and DIB?

Postby me » Fri, 07 Oct 2005 06:07:49 GMT

I am very confused about the definition of DDB vs. DIB. I have read
many articles and usenet posts about this, they just give the
definition in general terms, i.e. that DDB can only be rendered
directly to a certain video card, and DIB can only be rendered on any
video card or printer but is slower.

But I do not understand the technical aspect. Let's say we have a 10x10
pixel bitmap, with 32 bit color, that is a DIB. For each of those 100
pixels of a DIB, there is a 4 byte value that represents the colors.
Correct? If this is the case, how would a DDB differ from this?

What about for 24 bit and 16 bit color?

Re: can someone explain the definition of DDB and DIB?

Postby me » Fri, 07 Oct 2005 06:56:22 GMT

This tutorial cleared up some of my confusion.


If I understand correctly, the reason for DIB and DDB is to deal with
video cards that use palettes less than 24 bit.

Re: can someone explain the definition of DDB and DIB?

Postby Mike D Sutton » Fri, 07 Oct 2005 09:35:32 GMT

> I am very confused about the definition of DDB vs. DIB. I have read

A DDB is a Device Dependant Bitmap which is managed by the graphics driver for optimal display performance (and as such is always 
stored at the optimal bit-depth, i.e. the depth of the device it's associated with.)  The exception to this is the 1-BPP DDB which 
is a special case Bitmap that's used to perform various masking operations such as drawing icons which are used throughout the OS, 
and therefore are treated as a special case.
Technically a DIB is not really comparable to a DDB since it's just a term to describe the combination of a Bitmap header and it's 
data, however it's commonly used interchangeably with it's GDI representation the DIBSection.
A DIBSection is a Device Independent Bitmap which focuses more on preserving the image data rather than display performance, this 
means that it's bit depth can be specified independently to the device it's associated with and a bit-depth conversion is made when 
it's drawn.  The other offshoot of this is that since the graphics driver does not manage the image data you get direct access to 
the underlying object data which makes editing DIBSections very efficient (as opposed to a DDB which require the data to be copied 
to or from the object in order to edit it.)
The DIB can also be represented in a file (i.e. the BMP or ICO file formats with the appropriate headers), or as a PackedDIB which 
is a DIB stored in a global memory object.

That's entirely up to the graphics driver - If the display depth is running at 16-bit then the data would also be stored at 16-bit 
which means the image data would be lost.

A DIB would store the data at whatever bit-depth you require it to, however the graphics driver will manage the DDB data as it sees 
Hope this helps,


 - Microsoft Visual Basic MVP -
WWW:  http://www.**--****.com/ 

Return to Win32 Programming


Who is online

Users browsing this forum: No registered users and 63 guest