Creating Device-Dependent Bitmaps

When an application requests the creation of a bitmap, a driver can create and manage a DDB by supporting the DrvCreateDeviceBitmap function. When such a driver creates the bitmap, it can store the bitmap in any format. The driver examines the passed parameters and provides a bitmap with at least as many bits-per-pixel as requested.

Note Graphics drivers can improve performance by supporting bitmaps in offscreen memory and by drawing bitmaps using hardware, such as in the case of the S3 display driver.

Within DrvCreateDeviceBitmap, the driver calls the GDI service EngCreateDeviceBitmap to have GDI create a handle for the device bitmap.

If the driver supports DrvCreateDeviceBitmap, it creates a DDB, defines its format, and returns a handle to it. The driver controls where the bitmap is stored, and in what format. The driver should support the color format that matches its device surface most closely.

The contents of the bitmap are undefined after creation. If the application has requested a device-managed bitmap, GDI calls DrvBitBlt after DrvCreateDeviceBitmap returns control. If the driver returns zero, it does not create and manage the bitmap, instead GDI performs these tasks.

If the driver creates bitmaps, it must also be able to delete them by implementing DrvDeleteDeviceBitmap.