Public Member Functions | Public Attributes

GammaMgr Class Reference

This reference page is linked to from the following overview topics: Gamma Preferences.


Search for all occurrences

Detailed Description

See also:
Class Color, COLORREF.

Description:
The gamma manager class. Methods of this class are used to gamma correct and de-gamma colors in various formats. Various settings from the 3ds Max user interface are also accessible via data members of this class (for example the display, and file gamma settings). These settings may be read but should not be set by a plug-in developer. All methods of this class are implemented by the system.

There is a global instance of this class (defined in /MAXSDK/INCLUDE/GAMMA.H):

GammaMgr gammaMgr;

Note the following #defines. These are used to reduce the size of the gamma tables for correcting 16 bit values.

#define RCBITS 13

#define RCOLN (1<<RCBITS)

This class provides a set of commonly used gamma tables. This class does not provide tables for all types of conversion however. For example if you have a different gamma setting that you are using, or if you are going in a different conversion direction than the tables provided here you may use the classes GamConvert16 and GamConvert8 to build gamma tables.
Data Members:
BOOL enable;

Indicates if gamma correction is enabled or disabled.

BOOL dithTrue;

Indicates if output dithering is to be used for true color images.

BOOL dithPaletted;

Indicates if output dithering is to be used for paletted images.

float dispGamma;

The display gamma setting.

float fileInGamma;

The file input gamma setting.

float fileOutGamma;

The file output gamma setting.

UBYTE disp_gamtab[256];

Display gamma table for drawing color swatches (8->8)

UBYTE disp_gamtabw[RCOLN];

Display gamma table (RCBITS->8).

UBYTE file_in_gamtab[256];

File input gamma table (8->8).

UWORD file_in_degamtab[256];

For de-gamifying bitmaps on input. (8->16)

UWORD file_out_gamtab[RCOLN];

Gamma correct for file output, before dither (RCBITS->16).

#include <gamma.h>

Inheritance diagram for GammaMgr:
Inheritance graph
[legend]

List of all members.

Public Member Functions

COLORREF  DisplayGammaCorrect (COLORREF col)
CoreExport Color  DisplayGammaCorrect (Color c)
CoreExport void  Enable (BOOL onOff)
BOOL  IsEnabled ()
CoreExport void  SetDisplayGamma (float gam)
float  GetDisplayGamma ()
CoreExport void  SetFileInGamma (float gam)
float  GetFileInGamma ()
CoreExport void  SetFileOutGamma (float gam)
float  GetFileOutGamma ()
  GammaMgr ()

Public Attributes

BOOL  enable
BOOL  dithTrue
BOOL  dithPaletted
float  dispGamma
float  fileInGamma
float  fileOutGamma
UBYTE  disp_gamtab [256]
UBYTE  disp_gamtabw [RCOLN]
UBYTE  file_in_gamtab [256]
UWORD  file_in_degamtab [256]
UWORD  file_out_gamtab [RCOLN]

Constructor & Destructor Documentation

GammaMgr ( )
Remarks:
Constructor.

Member Function Documentation

COLORREF DisplayGammaCorrect ( COLORREF  col ) [inline]
Remarks:
Gamma corrects the specified color using the display gamma setting.
Parameters:
COLORREF col

The color to gamma correct.
Returns:
The gamma corrected color.
                                                          {
            return RGB(disp_gamtab[GetRValue(col)], disp_gamtab[GetGValue(col)], disp_gamtab[GetBValue(col)]);      
            }
CoreExport Color DisplayGammaCorrect ( Color  c )
Remarks:
Gamma corrects the specified color using the display gamma setting.
Parameters:
Color c

The color to gamma correct.
Returns:
The gamma corrected color.
CoreExport void Enable ( BOOL  onOff )
Remarks:
Sets the gamma correction enabled setting.
Parameters:
BOOL onOff

TRUE to enable; FALSE to disable.
BOOL IsEnabled ( ) [inline]
Remarks:
Returns the gamma correction enabled setting; TRUE if enabled; FALSE if disabled.
{ return enable;}
CoreExport void SetDisplayGamma ( float  gam )
Remarks:
Sets the display gamma setting.
Parameters:
float gam

The value to set.
float GetDisplayGamma ( ) [inline]
Remarks:
Returns the display gamma setting.
{ return dispGamma; }
CoreExport void SetFileInGamma ( float  gam )
Remarks:
Sets the file input gamma setting.
Parameters:
float gam

The value to set.
float GetFileInGamma ( ) [inline]
Remarks:
Returns the file input gamma setting.
{ return fileInGamma; }
CoreExport void SetFileOutGamma ( float  gam )
Remarks:
Sets the file output gamma setting.
Parameters:
float gam

The value to set.
float GetFileOutGamma ( ) [inline]
Remarks:
Returns the file output gamma setting.
{ return fileOutGamma; }

Member Data Documentation

BOOL enable
BOOL dithTrue
float dispGamma
float fileInGamma
float fileOutGamma
UBYTE disp_gamtab[256]
UBYTE disp_gamtabw[RCOLN]
UBYTE file_in_gamtab[256]
UWORD file_in_degamtab[256]
UWORD file_out_gamtab[RCOLN]

GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr
GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr GammaMgr