L_DefaultDithering

#include "l_bitmap.h"

L_LTKRN_API L_INT L_DefaultDithering(uMethod)

Specifies the default dithering method to use when converting an image from 64, 48, 32, 24, or 16 bits per pixel to 8 bits per pixel or fewer.

Parameters

L_UINT uMethod

The dithering method to use. Valid values are:

Value Meaning
NO_DITHERING [0] Use no dithering.
FLOYD_STEIN_DITHERING [1] Use the Floyd-Steinberg method.
BURKES_DITHERING [3] Use the Burkes method.
STUCKI_DITHERING [2] Use the Stucki method.
SIERRA_DITHERING [4] Use the Sierra method.
STEVENSON_ARCE_DITHERING [5] Use the Stevenson-Arce method.
JARVIS_DITHERING [6] Use the Jarvis method.
ORDERED_DITHERING [7] Use ordered dithering, which is faster than other methods but is lower in quality.
CLUSTERED_DITHERING [8] Use clustered dithering.

Returns

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

Comments

Some LEADTOOLS functions automatically dither an image when necessary for display. Those functions use the default dithering method that this function specifies.

For general information about dithering, refer to Color Resolution and Dithering.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example sets NO_DITHERING as the default before loading a 24-bit image at 8 bits per pixel. This overrides the normal default, which is to use Floyd-Steinberg dithering.

L_INT DefaultDitheringExample(HWND          hWnd, 
                                              pBITMAPHANDLE pBitmap )  
{ 
   L_INT nRet; 
   /* Set the default dithering */ 
   nRet = L_DefaultDithering(NO_DITHERING); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Load the bitmap at 8 bits per pixel */ 
   if(pBitmap->Flags.Allocated) 
      L_FreeBitmap(pBitmap); 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), pBitmap, sizeof(BITMAPHANDLE), 8, 0, NULL, NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Update the paint palette */ 
   SendMessage (hWnd, WM_QUERYNEWPALETTE, 0, 0L); 
 
   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