3ds Max C++ API Reference
gamma.h File Reference
#include "maxheap.h"
#include <WTypes.h>
#include "maxtypes.h"
#include "coreexp.h"
#include "color.h"

Classes

class  GammaMgr
 
class  GamConvert16
 
class  GamConvert8
 

Macros

#define WRDMAX   65535
 
#define FWRDMAX   65535.0f
 
#define RCBITS   13
 
#define RCOLN   (1<<RCBITS)
 
#define RCMAX   (RCOLN-1)
 
#define FRCMAX   ((float)RCMAX)
 
#define RCHALF   (RCOLN>>1)
 
#define RCSH   (RCBITS-8) /* shift amount from 8 bit to RCBITS */
 
#define RCSH16   (16-RCBITS) /* shift amount from 16 bit to RCBITS */
 
#define RCFRACMASK   ((ulong)((1<<RCSH)-1))
 
#define RC_SCL   (1<<RCSH)
 
#define RC_SCLHALF   (1<<(RCSH-1))
 
#define FRC_SCL   ((float)RC_SCL)
 
#define RCSHMASK   (0xffffffffL<<RCSH)
 
#define RCSHMAX   (0xffL<<RCSH)
 
#define GAMMA_NTSC   2.2f
 
#define GAMMA_PAL   2.8f
 
#define GAMMA16to8(b)   gammaMgr.disp_gamtabw[b>>RCSH16]
 

Functions

COLORREF gammaCorrect (DWORD c)
 
UBYTE gammaCorrect (UBYTE b)
 
CoreExport void BuildGammaTab8 (UBYTE gamtab[256], float gamma, int onoff=TRUE)
 
CoreExport void BuildGammaTab8 (UWORD gamtab[256], float gamma, int onoff=TRUE)
 
CoreExport void BuildGammaTab (UBYTE gamtab[RCOLN], float gamma, int onoff=TRUE)
 
CoreExport void BuildGammaTab (UWORD gamtab[RCOLN], float gamma, int onoff=TRUE)
 
CoreExport float gammaCorrect (float v, float gamma)
 
CoreExport float deGammaCorrect (float v, float gamma)
 
CoreExport UBYTE gammaCorrect (UBYTE v, float gamma)
 
CoreExport UBYTE deGammaCorrect (UBYTE v, float gamma)
 
CoreExport UWORD gammaCorrect (UWORD c, float gamma)
 
CoreExport UWORD deGammaCorrect (UWORD c, float gamma)
 

Variables

CoreExport GammaMgr gammaMgr
 

Macro Definition Documentation

◆ WRDMAX

#define WRDMAX   65535

◆ FWRDMAX

#define FWRDMAX   65535.0f

◆ RCBITS

#define RCBITS   13

◆ RCOLN

#define RCOLN   (1<<RCBITS)

◆ RCMAX

#define RCMAX   (RCOLN-1)

◆ FRCMAX

#define FRCMAX   ((float)RCMAX)

◆ RCHALF

#define RCHALF   (RCOLN>>1)

◆ RCSH

#define RCSH   (RCBITS-8) /* shift amount from 8 bit to RCBITS */

◆ RCSH16

#define RCSH16   (16-RCBITS) /* shift amount from 16 bit to RCBITS */

◆ RCFRACMASK

#define RCFRACMASK   ((ulong)((1<<RCSH)-1))

◆ RC_SCL

#define RC_SCL   (1<<RCSH)

◆ RC_SCLHALF

#define RC_SCLHALF   (1<<(RCSH-1))

◆ FRC_SCL

#define FRC_SCL   ((float)RC_SCL)

◆ RCSHMASK

#define RCSHMASK   (0xffffffffL<<RCSH)

◆ RCSHMAX

#define RCSHMAX   (0xffL<<RCSH)

◆ GAMMA_NTSC

#define GAMMA_NTSC   2.2f

◆ GAMMA_PAL

#define GAMMA_PAL   2.8f

◆ GAMMA16to8

#define GAMMA16to8 (   b)    gammaMgr.disp_gamtabw[b>>RCSH16]

Function Documentation

◆ gammaCorrect() [1/5]

COLORREF gammaCorrect ( DWORD  c)
inline
Remarks
Returns a gamma corrected version of the specified color using the display gamma setting.
Parameters:
DWORD c

The color to gamma correct.
169 { return gammaMgr.DisplayGammaCorrect(c); }
COLORREF DisplayGammaCorrect(COLORREF col)
Definition: gamma.h:110
CoreExport GammaMgr gammaMgr

◆ gammaCorrect() [2/5]

UBYTE gammaCorrect ( UBYTE  b)
inline
Remarks
Returns a gamma corrected version of the specified color using the display gamma setting.
Parameters:
UBYTE b

The color to gamma correct.
175 { return gammaMgr.disp_gamtab[b]; }
UBYTE disp_gamtab[256]
Definition: gamma.h:98

◆ BuildGammaTab8() [1/2]

CoreExport void BuildGammaTab8 ( UBYTE  gamtab[256],
float  gamma,
int  onoff = TRUE 
)
Remarks
Builds the gamma table that maps 8->8.
Parameters:
UBYTE gamtab[256]

The table to build.

float gamma

The gamma setting.

int onoff=TRUE

TRUE to enable; FALSE to disable.

◆ BuildGammaTab8() [2/2]

CoreExport void BuildGammaTab8 ( UWORD  gamtab[256],
float  gamma,
int  onoff = TRUE 
)
Remarks
Builds a gamma table that maps 8->16.
Parameters:
UBYTE gamtab[256]

The table to build.

float gamma

The gamma setting.

int onoff=TRUE

TRUE to enable; FALSE to disable.

◆ BuildGammaTab() [1/2]

CoreExport void BuildGammaTab ( UBYTE  gamtab[RCOLN],
float  gamma,
int  onoff = TRUE 
)
Remarks
Build a gamma table that maps RCBITS->8.
Parameters:
UBYTE gamtab[RCOLN]

The table to build.

float gamma

The gamma setting.

int onoff=TRUE

TRUE to enable; FALSE to disable.

◆ BuildGammaTab() [2/2]

CoreExport void BuildGammaTab ( UWORD  gamtab[RCOLN],
float  gamma,
int  onoff = TRUE 
)
Remarks
Build a gamma table that maps RCBITS->16.
Parameters:
UWORD gamtab[RCOLN]

The table to build.

float gamma

The gamma setting.

int onoff=TRUE

TRUE to enable; FALSE to disable.

◆ gammaCorrect() [3/5]

CoreExport float gammaCorrect ( float  v,
float  gamma 
)
Remarks
Gamma corrects the value passed using the specified gamma setting.
Parameters:
float v

The value to gamma correct.

float gamma

The gamma setting.
Returns
The gamma corrected value.

◆ deGammaCorrect() [1/3]

CoreExport float deGammaCorrect ( float  v,
float  gamma 
)
Remarks
De-gamma corrects the value passed using the specified gamma setting.
Parameters:
float v

The value to de-gamma correct.

float gamma

The gamma setting.

◆ gammaCorrect() [4/5]

CoreExport UBYTE gammaCorrect ( UBYTE  v,
float  gamma 
)
Remarks
Gamma corrects the value passed using the specified gamma setting.
Parameters:
UBYTE v

The value to gamma correct.

float gamma

The gamma setting.
Returns
The gamma corrected value.

◆ deGammaCorrect() [2/3]

CoreExport UBYTE deGammaCorrect ( UBYTE  v,
float  gamma 
)
Remarks
De-gamma corrects the value passed using the specified gamma setting.
Parameters:
UBYTE v

The value to de-gamma correct.

float gamma

The gamma setting.

◆ gammaCorrect() [5/5]

CoreExport UWORD gammaCorrect ( UWORD  c,
float  gamma 
)
Remarks
Gamma corrects the value passed using the specified gamma setting.
Parameters:
UWORD c

The value to gamma correct.

float gamma

The gamma setting.
Returns
The gamma corrected value.

◆ deGammaCorrect() [3/3]

CoreExport UWORD deGammaCorrect ( UWORD  c,
float  gamma 
)
Remarks
De-gamma corrects the value passed using the specified gamma setting.
Parameters:
UWORD c

The value to de-gamma correct.

float gamma

The gamma setting.

Variable Documentation

◆ gammaMgr

CoreExport GammaMgr gammaMgr
extern