GammaMgr Class Reference

#include <gamma.h>

Class 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).
+ Inheritance diagram for GammaMgr:

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]
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 

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.
110  {
111  return RGB(disp_gamtab[GetRValue(col)], disp_gamtab[GetGValue(col)], disp_gamtab[GetBValue(col)]);
112  }
UBYTE disp_gamtab[256]
Definition: gamma.h:98
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.
129 { return enable;}
BOOL enable
Definition: gamma.h:92
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.
137 { return dispGamma; }
float dispGamma
Definition: gamma.h:95
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.
145 { return fileInGamma; }
float fileInGamma
Definition: gamma.h:96
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.
153 { return fileOutGamma; }
float fileOutGamma
Definition: gamma.h:97

Member Data Documentation

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]