L_SetDisplayMode

Summary

Sets flags that control the speed, quality, and style of painting operations.

Syntax

#include "l_bitmap.h"

L_LTDIS_API L_UINT L_SetDisplayMode(uFlagPos, uFlagSet)

Parameters

L_UINT uFlagPos

The flag or flags to be changed. You can use a bitwise OR ( | ) to specify more than one flag. You can use DISPLAYMODE_RESETPOSITIONS to indicate all flags.

Refer to Flags for the L_SetDisplayMode Function for descriptions of the flags.

L_UINT uFlagSet

The flags (of those specified in the uFlagPos parameter) to be turned on. You can use a bitwise OR ( | ) to include more than one flag. You can use 0 to turn off all the flags specified in the uFlagPos parameter.

Refer to Flags for the L_SetDisplayMode Function for descriptions of the flags.

Returns

The unsigned integer containing the painting control flags as they were set before calling this function.

Comments

The first parameter specifies which flags are affected, and the second specifies which of those to turn on. The other affected flags are turned off.

Therefore:

For example, the following statement turns on fast painting, turns off dithered painting, and leaves all other flags as they were:

L_SetDisplayMode (DISPLAYMODE_FASTPAINT | DISPLAYMODE_DITHEREDPAINT, DISPLAYMODE_FASTPAINT ); 

For the fastest paint, neither DISPLAYMODE_BICUBIC nor DISPLAYMODE_RESAMPLE should be set.

DISPLAYMODE_RESAMPLE and DISPLAYMODE_BICUBIC cannot be combined.

When painting 1BPP images, DISPLAYMODE_FAVORBLACK and DISPLAYMODE_SCALETOGRAY take precedence over DISPLAYMODE_RESAMPLE and DISPLAYMODE_BICUBIC.

DISPLAYMODE_RESAMPLE is faster than DISPLAYMODE_BICUBIC, but DISPLAYMODE_BICUBIC produces better results when zooming in on images. When zooming out, DISPLAYMODE_BICUBIC and DISPLAYMODE_RESAMPLE produce the same effect.

DISPLAYMODE_GDIPLUS will use Microsoft GDI+ instead of the Windows GDI when painting images. GDI+ is generally slower than GDI however it adds support for painting 32 and 64-bit bitmaps with alpha channels as well as paint a bitmap with transparent color (BITMAPHANDLE.Flags.Transparency set to TRUE). Using this flag requires the Microsoft GDI+ runtime DLL (gdiplus.dll) to be installed on the machine.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

For a complete sample code, refer to the LOADSAVE example.
This example sets the display to use scale-to-gray, then repaints with a
grayscale palette. It checks for the current setting and Document/Medical capabilities
before changing the display mode. This affects only 1-bit images.

L_INT SetDisplayModeExample(L_HWND hWnd) 
{ 
   L_INT nRet = SUCCESS; 
 
   if (L_GetDisplayMode() == DISPLAYMODE_SCALETOGRAY) 
      _tprintf(_T("%s"), TEXT("Notice: Already using scale-to-gray.")); 
   else if (L_IsSupportLocked(L_SUPPORT_DOCUMENT)) 
      _tprintf(_T("%s"), TEXT("Notice: No scale to gray - Unlock Document/Medical capabilities.")); 
   else 
   { 
      /* Set the display mode to scale-to-gray */ 
      nRet = L_SetDisplayMode(DISPLAYMODE_SCALETOGRAY, DISPLAYMODE_SCALETOGRAY); 
      if (nRet == SUCCESS) 
         /* Get a new palette as the paint palette because we are now using grayscale, instead of 1-bit */ 
         SendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0L); 
   } 
 
   return nRet; 
} 

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

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.