L_ChangeBitmapCompression

#include "l_bitmap.h"

L_LTKRN_API L_INT L_ChangeBitmapCompression(pBitmap, nComp)

Compresses of decompresses a bitmap.

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the bitmap to compress or decompress.

L_INT nComp

Flag that indicates the type of compression to use on the bitmap. Possible values are:

Value Meaning
COMP_NONE [0] No compression. This option can be used to decompress compressed or super compressed bitmaps.
COMP_RLE [1] 1-bit RLE compression. This compression is very fast and Lossless. For more information, refer to Speeding Up 1-Bit Documents. This is the same as passing TYPE_COMPRESSED to L_AllocateBitmap.
COMP_SUPER [2] Super compression. This is available for 1-bit, 8-bit, and 24-bit bitmaps only. The 24-bit and 8-bit compression is lossy, while the 1-bit compression is lossless.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function should be used instead of L_ToggleBitmapCompression.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This function toggles bitmap compression.

L_INT ChangeBitmapCompressionExample(HWND  hWnd, pBITMAPHANDLE   pBitmap) 
{ 
   L_INT     nRet = 0; 
   L_TCHAR   s[100]; 
 
   if(pBitmap->BitsPerPixel == 1 || pBitmap->BitsPerPixel == 8 || pBitmap->BitsPerPixel == 24) 
   { 
      wsprintf(s, TEXT("BEFORE - ImageSize: %ld bytes, Type: %s"), pBitmap->Size, (pBitmap->Flags.SuperCompressed ? TEXT("SUPERCOMP") : TEXT("UNCOMP"))); 
      MessageBox(hWnd, s, TEXT("ChangeBitmapCompression"), MB_OK); 
      nRet = L_ChangeBitmapCompression(pBitmap, pBitmap->Flags.SuperCompressed ? COMP_NONE : COMP_SUPER); 
      if(nRet == SUCCESS) 
         wsprintf(s, TEXT("AFTER - ImageSize: %ld bytes, Type: %s"), pBitmap->Size, (pBitmap->Flags.SuperCompressed ? TEXT("SUPERCOMP") : TEXT("UNCOMP"))); 
      else 
      { 
         wsprintf(s, TEXT("L_ChangeBitmapCompression Failed")); 
         return nRet; 
      } 
      MessageBox(hWnd, s, TEXT("ChangeBitmapCompression"), MB_OK); 
   } 
   return SUCCESS; 
} 

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help