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.

The following functions are used to change and set/get the local settings for bitmap objects:

LBitmapBase::GetDefaultDithering

LBitmapBase::SetDefaultDithering

LBitmapBase::GetDisplayMode

LBitmapBase::SetDisplayMode

The following functions can be used to set/get the global settings for painting bitmaps:

LBitmapSettings::DefaultDithering

LBitmapSettings::GetDisplayMode

LBitmapSettings::SetDisplayMode

And the functions that can be used to enable/disable the local settings for bitmap objects are:

LBitmapBase::EnableLocalSettings

LBitmapBase::IsLocalSettingsEnabled  

Example

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 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help