LChange::ChangeToDIB

Summary

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.

Syntax

#include "ltwrappr.h"

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

Parameters

LBitmapBase * pLBitmap

Pointer to a LEAD bitmap object referencing the bitmap to change.

L_UINT 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

Value Meaning
>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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

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 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.