Using Global and Local Settings for Bitmap Objects

When declaring or creating a bitmap object, its local settings are enabled by default. The default local settings are filled from the current global settings.

Once an object is created it will take its default values from the global settings.

The user can force a specific object to use global settings by calling (LBitmapBase::EnableLocalSettings(FALSE)) to disable the local settings.

Local settings are only used if they are enabled. Using LPaint or LPaintEffects to paint a bitmap that has its local settings enabled will cause the class object's local settings to be set before executing the paint function and then the global settings will be restored after executing the paint function. This will cause the bitmap to be painted using the object's local settings. On the other hand if local settings are disabled for a specific bitmap object, then the global settings will be used when painting the bitmap.

Set/get the local settings for bitmap objects

LBitmapBase::GetDefaultDithering

LBitmapBase::SetDefaultDithering

LBitmapBase::GetDisplayMode

LBitmapBase::SetDisplayMode

Set/get the global settings for painting bitmaps

LBitmapSettings::DefaultDithering

LBitmapSettings::GetDisplayMode

LBitmapSettings::SetDisplayMode

Enable/disable the local settings for bitmap objects

LBitmapBase::EnableLocalSettings

LBitmapBase::IsLocalSettingsEnabled

As an illustration on how to use global and local settings for bitmap objects, see the code below:

LBitmapBase MyBitmap;   
LPaint MyPaint;   
HDC hDC; 
 
// load a bitmap   
MyBitmap.Load(TEXT("image1.cmp"));   
 
// then disable the local settings for the bitmap object   
MyBitmap.EnableLocalSettings(FALSE);   
 
// change the local settings for the bitmap object to some values   
MyBitmap.SetPaintContrast(50);   
MyBitmap.SetPaintGamma(150);   
MyBitmap.SetPaintIntensity(-50);   
 
// initialize the paint object with the bitmap and the DC of the desktop window   
MyPaint.SetBitmap(&MyBitmap);   
hDC=GetDC(0);   
MyPaint.SetDC(hDC);   
 
// now paint the bitmap using the global settings   
MyPaint.PaintDC();   
 
// now enable the local settings for the bitmap object   
MyBitmap.EnableLocalSettings(TRUE);   
 
// then paint the bitmap object using its local settings   
MyPaint.PaintDC();   
 
// ...   
ReleaseDC(0, hDC); 

Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 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.