L_ChangeToDDB

#include "l_bitmap.h"

HBITMAP EXT_FUNCTION L_ChangeToDDB(hDC, pBitmap)

HDC hDC;

/* handle to the device responsible for the conversion */

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

Changes a LEAD bitmap handle to a Windows Device Dependent Bitmap (DDB). This function results in only one copy of the bitmap, and it invalidates the LEAD bitmap handle.

Parameter

Description

hDC

Handle to the device responsible for the conversion. The mapping mode of the device context must be MM_TEXT.

pBitmap

Pointer to the bitmap handle referencing the bitmap to change.

Returns

>0

HBITMAP.

0

An error occurred.

Comments

If you want to load another image using the same bitmap handle, you must initialize the bitmap handle again.

Platforms

Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.

Required DLLs and Libraries

LTDIS

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_ConvertFromDDB, L_ConvertFromDIB,

 

L_ConvertToDDB, L_ConvertToDIB,

 

L_ChangeFromDDB, L_ChangeFromDIB,

 

L_ChangeToDIB

Topics:

Raster Image Functions: Creation, Deletion, and Copying

 

Using DIBs, DDBs, and the Clipboard

Example

/* This example loads a bitmap, changes it to a DDB, then changes
the DDB back to a bitmap */
BITMAPHANDLE LeadBitmap;   /* Bitmap handle for the image */
void TestFunction(HWND hWnd)
{
   BITMAPHANDLE TmpBitmap;    /* Bitmap handle for the initial image */
   HBITMAP hDDB; /* Handle for the DDB */
   HPALETTE hPalette; /* Palette handle */
   HDC hDC;  /* Handle to the device context for the current window */
   /* Get the device context for the current window */
   hDC = GetDC( hWnd );
   /* Load a bitmap at 8 bits per pixel so that we can demonstrate palette handling */
   L_LoadBitmap (TEXT("image3.cmp"), &TmpBitmap, sizeof(BITMAPHANDLE), 8, ORDER_BGR, NULL, NULL);
   /* Duplicate the palette */
   hPalette = L_DupBitmapPalette(&TmpBitmap);
   /* Change the initial bitmap to a DDB */
   hDDB = L_ChangeToDDB( hDC, &TmpBitmap );
   /* Change the DDB to a new LEAD bitmap */
   L_ChangeFromDDB(hDC, &LeadBitmap, sizeof(BITMAPHANDLE), hDDB, hPalette);
   /* Clean up */
   ReleaseDC( hWnd, hDC );
   DeleteObject(hPalette);
   return;
}