Displaying and Printing

Bitmaps are for looking at. In this section, we’ll begin by looking at the two functions that Windows supports for displaying a DIB on the video display or a printer page. For better performance, you may eventually prefer a more roundabout method for displaying bitmaps that I’ll discuss later in this chapter. But these two functions are a logical first start.

The two functions are called SetDIBitsToDevice (pronounced “set dee eye bits to device”) and StretchDIBits (“stretch dee eye bits”). Each function uses a DIB stored in memory and can display the entire DIB or a rectangular portion of it. When you use SetDIBitsToDevice, the size of the displayed image in pixels will be the same as the pixel size of the DIB. For example, ...

Get Programming Windows®, Fifth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.