Data Structures | Typedefs | Functions
AtColor API

Data Structures

struct  AtRGB
 RGB color. More...
 
struct  AtRGBA
 RGB color + alpha. More...
 

Typedefs

typedef AtRGB AtColor
 RGB color (same as AtRGB)
 

Functions

AtRGB operator* (float f, const AtRGB &rgb)
 
AtRGB operator+ (float f, const AtRGB &rgb)
 
AtRGB operator- (float f, const AtRGB &rgb)
 
AtRGBA operator* (float f, const AtRGBA &rgba)
 
AtRGBA operator+ (float f, const AtRGBA &rgba)
 
AtRGBA operator- (float f, const AtRGBA &rgba)
 

Color Operations

AtColor AiColor (float f)
 Create a RGB color using the same value for all components.
 
AtColor AiColor (float r, float g, float b)
 Create a RGB color from its components.
 
AtRGBA AiRGBACreate (const float r, float g, float b, float a)
 Create a RGBA color from its components.
 
void AiColorReset (AtColor &c)
 Create a zero RGB color, c = (0, 0, 0)
 
void AiRGBAReset (AtRGBA &rgba)
 Create a zero RGBA color, c = (0, 0, 0, 0)
 
AtColor AiColorLerp (float t, const AtColor &lo, const AtColor &hi)
 Linear interpolation between two RGB colors. More...
 
AtRGBA AiColorLerp (float t, const AtRGBA &lo, const AtRGBA &hi)
 Linear interpolation between two RGBA colors. More...
 
AtColor AiColorHerp (float t, const AtColor &lo, const AtColor &hi)
 Cubic Hermite interpolation between two RGB colors. More...
 
AtRGBA AiColorHerp (float t, const AtRGBA &lo, const AtRGBA &hi)
 Cubic Hermite interpolation between two RGBA colors. More...
 
AtRGBA AiRGBALerp (float t, const AtRGBA &lo, const AtRGBA &hi)
 Linear interpolation between two RGBA colors. More...
 
AtRGBA AiRGBAHerp (float t, const AtRGBA &lo, const AtRGBA &hi)
 Cubic Hermite interpolation between two RGBA colors. More...
 
AtColor AiColorBiLerp (float s, float t, const AtColor &c00, const AtColor &c10, const AtColor &c01, const AtColor &c11)
 Bilinear interpolation between four RGB colors. More...
 
AtColor AiColorBiHerp (float s, float t, const AtColor &c00, const AtColor &c10, const AtColor &c01, const AtColor &c11)
 Bicubic Hermite interpolation between four RGB colors. More...
 
AtRGBA AiRGBAbiLerp (float s, float t, const AtRGBA &c00, const AtRGBA &c10, const AtRGBA &c01, const AtRGBA &c11)
 Bilinear interpolation between four RGBA colors. More...
 
AtRGBA AiRGBAbiHerp (float s, float t, const AtRGBA &c00, const AtRGBA &c10, const AtRGBA &c01, const AtRGBA &c11)
 Bicubic Hermite interpolation between four RGBA colors. More...
 
AtColor AiColorClamp (const AtColor &c, float lo, float hi)
 Clamp the RGB color vector to the specified range.
 
AtRGBA AiRGBAClamp (const AtRGBA &c, float lo, float hi)
 Clamp the RGBA color vector to the specified range.
 
void AiColorClipToZero (AtColor &c)
 Clip negative values.
 
bool AiColorIsSmall (const AtRGB &c, float epsilon=AI_EPSILON)
 Check for almost black.
 
bool AiColorEqual (const AtColor &a, const AtColor &b)
 Check if two colors are equal.
 
bool AiColorEqual (const AtRGBA &a, const AtRGBA &b)
 Check if two colors are equal, RGBA version (ignores alpha)
 
AtColor AiColorABS (const AtColor &c)
 Absolute value of color.
 
AtRGBA AiColorABS (const AtRGBA &c)
 Absolute value of color, RGBA version.
 
float AiColorMaxRGB (const AtColor &c)
 Max RGB component of color.
 
float AiColorMaxRGB (const AtRGBA &c)
 Max RGB component of color, RGBA version (ignores alpha)
 
bool AiColorThreshold (const AtColor &c1, const AtColor &c2, float t)
 Check to see if two colors differ by more than a threhsold.
 
AtColor AiRGBAtoRGB (const AtRGBA &rgba)
 Convert a RGBA color to a RGB color (ignoring alpha)
 
AtRGBA AiRGBtoRGBA (const AtColor &c)
 Convert a RGB color to a RGBA color (setting alpha to 1.0)
 
float AiColorToGrey (const AtColor &c)
 Convert a RGB color to grey scale (take average of R, G, B)
 
float AiColorToGrey (const AtRGBA &rgba)
 Convert a RGBA color to grey scale (take average of R, G, B - ignore alpha)
 
AI_API bool AiRGBCorrupted (const AtRGB &rgba)
 Check to see if an RGB color has any corrupted components (nan or infinite).
 
AI_API bool AiRGBACorrupted (const AtRGBA &rgba)
 Check to see if an RGBA color has any corrupted components (nan or infinite).
 
bool AiColorCorrupted (const AtColor &c)
 Check to see if a color has any corrupted components (nan or infinite).
 
bool AiColorCorrupted (const AtRGBA &rgba)
 Check to see if an RGBA color has any corrupted components (nan or infinite).
 
AtColor AiBerpRGB (float a, float b, const AtColor &c0, const AtColor &c1, const AtColor &c2)
 Barycentric interpolation of triangle vertex colors.
 
AI_API void AiColorGamma (AtColor *color, float gamma)
 Gamma-correct a color value. More...
 
AI_API void AiRGBAGamma (AtRGBA *color, float gamma)
 Gamma-correct a RGBA color value. More...
 
AI_API AtColor AiColorHeatMap (const AtColor *map_colors, const float *map_values, unsigned int map_length, float lookup)
 Interpolate a value according to a heat map (piecewise linear color map). More...
 
#define AiColorIsZero   AiColorIsSmall
 Check for almost black.
 

Deprecated

void AiColorLerp (AtColor &out, float t, const AtColor &lo, const AtColor &hi)
 
void AiColorLerp (AtRGBA &out, float t, const AtRGBA &lo, const AtRGBA &hi)
 
void AiColorLerp (AtColor &out, float t, const AtRGBA &lo, const AtRGBA &hi)
 
void AiColorHerp (AtColor &out, float t, const AtColor &lo, const AtColor &hi)
 
void AiColorHerp (AtRGBA &out, float t, const AtRGBA &lo, const AtRGBA &hi)
 
void AiRGBALerp (AtRGBA &out, float t, const AtRGBA &lo, const AtRGBA &hi)
 
void AiRGBAHerp (AtRGBA &out, float t, const AtRGBA &lo, const AtRGBA &hi)
 
void AiColorBiLerp (AtColor &out, float s, float t, const AtColor &c00, const AtColor &c10, const AtColor &c01, const AtColor &c11)
 
void AiColorBiHerp (AtColor &out, float s, float t, const AtColor &c00, const AtColor &c10, const AtColor &c01, const AtColor &c11)
 
void AiRGBAbiLerp (AtRGBA &out, float s, float t, const AtRGBA &c00, const AtRGBA &c10, const AtRGBA &c01, const AtRGBA &c11)
 
void AiRGBAbiHerp (AtRGBA &out, float s, float t, const AtRGBA &c00, const AtRGBA &c10, const AtRGBA &c01, const AtRGBA &c11)
 
void AiColorClamp (AtColor &out, const AtColor &c, float lo, float hi)
 
void AiRGBAClamp (AtRGBA &out, const AtRGBA &c, float lo, float hi)
 
void AiColorABS (AtColor &out, const AtColor &c)
 
void AiColorABS (AtRGBA &out, const AtRGBA &c)
 
void AiRGBAtoRGB (const AtRGBA &rgba, AtColor &out)
 
void AiRGBtoRGBA (const AtColor &c, AtRGBA &out)
 
void AiBerpRGB (float a, float b, const AtColor &c0, const AtColor &c1, const AtColor &c2, AtColor &out)
 
AtColor AiColorCreate (float r, float g, float b)
 
void AiColorCreate (AtColor &out, float r, float g, float b)
 
void AiRGBACreate (AtRGBA &out, float r, float g, float b, float a)
 
void AiColorAdd (AtColor &a, const AtColor &b, const AtColor &c)
 
void AiColorSub (AtColor &a, const AtColor &b, const AtColor &c)
 
void AiColorScale (AtColor &a, const AtColor &b, float k)
 
void AiColorAddScale (AtColor &a, const AtColor &b, const AtColor &c, float k)
 
void AiColorMult (AtColor &a, const AtColor &b, const AtColor &c)
 
void AiColorDiv (AtColor &a, const AtColor &b, const AtColor &c)
 

Constants

AI_API AtRGB AI_RGB_BLACK
 
AI_API AtRGB AI_RGB_RED
 
AI_API AtRGB AI_RGB_GREEN
 
AI_API AtRGB AI_RGB_BLUE
 
AI_API AtRGB AI_RGB_50GREY
 
AI_API AtRGB AI_RGB_WHITE
 
AI_API AtRGBA AI_RGBA_BLACK
 
AI_API AtRGBA AI_RGBA_RED
 
AI_API AtRGBA AI_RGBA_GREEN
 
AI_API AtRGBA AI_RGBA_BLUE
 
AI_API AtRGBA AI_RGBA_50GREY
 
AI_API AtRGBA AI_RGBA_WHITE
 

Detailed Description

Function Documentation

AtColor AiColorLerp ( float  t,
const AtColor lo,
const AtColor hi 
)
inline

Linear interpolation between two RGB colors.

(t=0 -> result=lo, t=1 -> result=hi)

AtRGBA AiColorLerp ( float  t,
const AtRGBA lo,
const AtRGBA hi 
)
inline

Linear interpolation between two RGBA colors.

(t=0 -> result=lo, t=1 -> result=hi)

AtColor AiColorHerp ( float  t,
const AtColor lo,
const AtColor hi 
)
inline

Cubic Hermite interpolation between two RGB colors.

(t=0 -> result=lo, t=1 -> result=hi)

AtRGBA AiColorHerp ( float  t,
const AtRGBA lo,
const AtRGBA hi 
)
inline

Cubic Hermite interpolation between two RGBA colors.

(t=0 -> result=lo, t=1 -> result=hi)

AtRGBA AiRGBALerp ( float  t,
const AtRGBA lo,
const AtRGBA hi 
)
inline

Linear interpolation between two RGBA colors.

(t=0 -> result=lo, t=1 -> result=hi)

AtRGBA AiRGBAHerp ( float  t,
const AtRGBA lo,
const AtRGBA hi 
)
inline

Cubic Hermite interpolation between two RGBA colors.

(t=0 -> result=lo, t=1 -> result=hi)

AtColor AiColorBiLerp ( float  s,
float  t,
const AtColor c00,
const AtColor c10,
const AtColor c01,
const AtColor c11 
)
inline

Bilinear interpolation between four RGB colors.

(s,t)=(0,0) -> result = c00, (s,t)=(1,1) -> result = c11, (s,t) in [0,1]

AtColor AiColorBiHerp ( float  s,
float  t,
const AtColor c00,
const AtColor c10,
const AtColor c01,
const AtColor c11 
)
inline

Bicubic Hermite interpolation between four RGB colors.

(s,t)=(0,0) -> result = c00, (s,t)=(1,1) -> result = c11, (s,t) in [0,1]

AtRGBA AiRGBAbiLerp ( float  s,
float  t,
const AtRGBA c00,
const AtRGBA c10,
const AtRGBA c01,
const AtRGBA c11 
)
inline

Bilinear interpolation between four RGBA colors.

(s,t)=(0,0) -> result = c00, (s,t)=(1,1) -> result = c11, (s,t) in [0,1]

AtRGBA AiRGBAbiHerp ( float  s,
float  t,
const AtRGBA c00,
const AtRGBA c10,
const AtRGBA c01,
const AtRGBA c11 
)
inline

Bicubic Hermite interpolation between four RGBA colors.

(s,t)=(0,0) -> result = c00, (s,t)=(1,1) -> result = c11, (s,t) in [0,1]

AI_API void AiColorGamma ( AtColor color,
float  gamma 
)

Gamma-correct a color value.

Warning
This is implemented with three calls to pow(), which can be slow if used in excess
Parameters
[in,out]colorthe input color, which will be overwritten with the gamma-corrected value
gammathe gamma value
AI_API void AiRGBAGamma ( AtRGBA color,
float  gamma 
)

Gamma-correct a RGBA color value.

This is similar to AiColorGamma() but operates on a RGBA color vector, leaving the alpha component untouched.

Warning
This is implemented with three calls to pow(), which can be slow if used in excess
Parameters
[in,out]colorthe input color, which will be overwritten with the gamma-corrected value
gammathe gamma value
AI_API AtColor AiColorHeatMap ( const AtColor map_colors,
const float *  map_values,
unsigned int  map_length,
float  lookup 
)

Interpolate a value according to a heat map (piecewise linear color map).

Parameters
map_colorsthe set of input colors
map_valuesthe floating point values assigned to each color
map_lengththe number of points in the map
lookupthe function evaluation position
Returns
the piecewise-linear interpolated color f(lookup).

© 2009-2013 Solid Angle SL · all rights reserved · www.solidangle.com