LChange::ChangeToDIB

#include "ltwrappr.h"

static HGLOBAL LChange::ChangeToDIB(pLBitmap,uType= DIB_BITMAPV5HEADER)

LBitmapBase * pLBitmap;

pointer to a LEAD bitmap object

L_UINT uType;

type of DIB

Changes an LBitmapBase object's internal LEAD bitmap handle to a Windows Device Independent Bitmap (DIB). This function results in only one copy of the bitmap, and it invalidates the LEAD bitmap handle.

Parameter Description
pLBitmap Pointer to a LEAD bitmap object referencing the bitmap to change.
uType Flag that indicates the type of DIB to be created. Possible values are:
  Value Meaning
  DIB_BITMAPINFOHEADER [0] DIB that uses a BITMAPINFOHEADER
  DIB_BITMAPV4HEADER [1] DIB that uses a BITMAPV4HEADER. (Introduced in Windows 95 and Windows NT 4.0)
  DIB_BITMAPV5HEADER [2] DIB that uses a BITMAPV5HEADER (Introduced in Windows 2000 and Windows 98).  This is the default value.

Returns

>0

Global memory handle to DIB.

0

An error occurred.

Comments

The orientation of the image and color order will depend on how the image was loaded into the LEAD bitmap.

A DIB consists of one of the following:

followed by a color table and then the bitmap data. The resulting DIB type is determined by the value of the uType flag.

When you no longer need the DIB, you can free it using the Windows GlobalFree() function.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

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.

Platforms

Win32, x64.

See Also

Functions:

LBitmapBase::ConvertFromDDB, LBitmapBase::ConvertFromDIB, LBitmapBase::ConvertToDDB, LBitmapBase::ConvertToDIB, LChange::ChangeFromDIB, Class Members

Topics:

Raster Image Functions: Creation, Deletion, and Copying

 

Using DIBs, DDBs, and the Clipboard

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT LChange__ChangeToDIBExample() 
{ 
   L_INT nRet; 
   LBitmapBase MyBitmap; 
   HGLOBAL  hDib; 
   nRet = MyBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp"))); 
   if(nRet != SUCCESS) 
      return nRet; 
   if(MyBitmap.IsAllocated()) 
   { 
      hDib=LChange::ChangeToDIB(&MyBitmap); 
      if(hDib!=0) 
      { 
         LBase::DisplayError(NULL,TEXT("Successful converting LEAD Bitmap to DIB Bitmap")); 
         MyBitmap.Free(); 
         nRet = LChange::ChangeFromDIB(&MyBitmap, sizeof(BITMAPHANDLE), hDib); 
         if(nRet != SUCCESS) 
            return nRet; 
         else 
            LBase::DisplayError(NULL,TEXT("Successful converting from DIB Bitmap to LEAD bitmap")); 
      } 
      else 
         LBase::DisplayErrorFromList(NULL); 
   } 
   else 
      LBase::DisplayError(NULL,TEXT("Cannot Load Bitmap")); 
   //... 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help