LBitmapBase::ConvertToDDB

#include "ltwrappr.h"

virtual HBITMAP LBitmapBase::ConvertToDDB(hDC)

HDC hDC;

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

Converts an LBitmapBase objects bitmap into a Windows device dependent bitmap (DDB). When this function is completed, there are two copies of the image in memory: the DDB and the original LEAD bitmap. Freeing one will not affect the other.

Parameter

Description

hDC

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

Returns

This function returns a handle to the DDB, or it returns a NULL if there is an error.

Comments

This function allocates a DDB bitmap and copies the LBitmapBase objects bitmap to the DDB. When you no longer need the DIB, you can free it using the Windows DeleteObject function.

Required DLLs and Libraries

LTDIS
LTFIL

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:

LBitmapBase::ConvertFromDIB, LBitmapBase::ConvertToDIB, LBitmapBase::ConvertFromDDB, Class Members

Topics:

Raster Image Functions: Creation, Deletion, and Copying

 

Using DIBs, DDBs, and the Clipboard

Example

L_INT LBitmapBase__ConvertToDDBExample()
{
   L_INT nRet;
   LBitmapBase MyBitmap,Bitmap2;
   HDC hDC=GetDC(0);
   HBITMAP hBitmap;
   nRet =MyBitmap.Load(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\image1.cmp"));
   if(nRet !=SUCCESS)
      return nRet;
   hBitmap=MyBitmap.ConvertToDDB(hDC);
   nRet =Bitmap2.ConvertFromDDB(hDC, hBitmap, 0);
   if(nRet !=SUCCESS)
      return nRet;
   ReleaseDC(0,hDC);
   return SUCCESS;
}