3ds Max C++ API Reference
Loading...
Searching...
No Matches
color.h File Reference
#include "GeomExport.h"
#include "point3.h"
#include "maxcolors.h"
#include <cstdint>

Classes

struct  RealPixel
 
class  Color
 
struct  LogLUV32Pixel
 
struct  LogLUV24Pixel
 

Macros

#define FLto255(x)   ((int)((x)*255.0f + .5f))
 
#define MAX_RGB(r, g, b)   ((uint32_t)(((uint8_t)(r) | ((uint16_t)((uint8_t)(g)) << 8)) | (((uint32_t)(uint8_t)(b)) << 16)))
 

Functions

RealPixel MakeRealPixel (float r, float g, float b)
 
void ExpandRealPixel (const RealPixel &rp, float &r, float &g, float &b)
 
int MaxComponent (const Color &)
 
int MinComponent (const Color &)
 
float MaxVal (const Color &)
 
float MinVal (const Color &)
 
float Length (const Color &v)
 
Color operator* (float f, const Color &a)
 
Color operator* (const Color &a, float f)
 
Color operator/ (const Color &a, float f)
 
Color operator+ (const Color &a, float f)
 
Color operator+ (float f, const Color &a)
 
Color operator- (const Color &a, float f)
 
Color operator- (float f, const Color &a)
 
static float Intens (const Color &c)
 

Macro Definition Documentation

◆ FLto255

#define FLto255 (   x)    ((int)((x)*255.0f + .5f))

◆ MAX_RGB

#define MAX_RGB (   r,
  g,
  b 
)    ((uint32_t)(((uint8_t)(r) | ((uint16_t)((uint8_t)(g)) << 8)) | (((uint32_t)(uint8_t)(b)) << 16)))

Function Documentation

◆ MakeRealPixel()

RealPixel MakeRealPixel ( float  r,
float  g,
float  b 
)

◆ ExpandRealPixel()

void ExpandRealPixel ( const RealPixel rp,
float &  r,
float &  g,
float &  b 
)

◆ MaxComponent()

int MaxComponent ( const Color )
Remarks
Returns the index of the component with the maximum absolute value.
Parameters:
const Color&

The color to check.
Returns
The index of the component with the maximum absolute value. r=0, g=1, b=2.

◆ MinComponent()

int MinComponent ( const Color )
Remarks
Returns the index of the component with the minimum absolute value
Parameters:
const Color&

The color to check.
Returns
The index of the component with the minimum absolute value. r=0, g=1, b=2.

◆ MaxVal()

float MaxVal ( const Color )
Remarks
Returns the value of the component with the maximum absolute value.
Parameters:
const Color&

The color to check.
Returns
The value of the component with the maximum absolute value.

◆ MinVal()

float MinVal ( const Color )
Remarks
The value of the component with the minimum absolute value.
Parameters:
const Color&

The color to check.
Returns

◆ Length()

float Length ( const Color v)
inline
Remarks
Returns the 'length' of the color, i.e.

return (float)sqrt(v.r*v.r+v.g*v.g+v.b*v.b);
Parameters:
const Color& v

The color to return the length of.
Returns
The length of the color.
Operators:
465{
466 return (float)sqrt(v.r * v.r + v.g * v.g + v.b * v.b);
467}
float r
These values are in the range 0.0 to 1.0.
Definition: color.h:78
float b
These values are in the range 0.0 to 1.0.
Definition: color.h:82
float g
These values are in the range 0.0 to 1.0.
Definition: color.h:80

◆ operator*() [1/2]

Color operator* ( float  f,
const Color a 
)
inline
535{
536 return (Color(a.r * f, a.g * f, a.b * f));
537}
Definition: color.h:73
float a
Definition: texutil.h:51

◆ operator*() [2/2]

Color operator* ( const Color a,
float  f 
)
inline
540{
541 return (Color(a.r * f, a.g * f, a.b * f));
542}

◆ operator/()

Color operator/ ( const Color a,
float  f 
)
inline
545{
546 return (Color(a.r / f, a.g / f, a.b / f));
547}

◆ operator+() [1/2]

Color operator+ ( const Color a,
float  f 
)
inline
550{
551 return (Color(a.r + f, a.g + f, a.b + f));
552}

◆ operator+() [2/2]

Color operator+ ( float  f,
const Color a 
)
inline
555{
556 return (Color(a.r + f, a.g + f, a.b + f));
557}

◆ operator-() [1/2]

Color operator- ( const Color a,
float  f 
)
inline
560{
561 return (Color(a.r - f, a.g - f, a.b - f));
562}

◆ operator-() [2/2]

Color operator- ( float  f,
const Color a 
)
inline
565{
566 return (Color(f - a.r, f - a.g, f - a.b));
567}

◆ Intens()

static float Intens ( const Color c)
inlinestatic
730{
731 return (c.r + c.g + c.b) / 3.0f;
732}