Introduction
Downloads
Documentation
Tutorials
Pixie Lite
Forum

Home

ColorHelper.h File Reference

Go to the source code of this file.


Defines

#define MIN(x, y)   (x<y?x:y)
#define MAX(x, y)   (x>y?x:y)

Functions

__forceinline unsigned short AlphaBlend16 (unsigned short color1, unsigned short color2, unsigned char alpha)
__forceinline unsigned int AlphaBlend32 (unsigned int color1, unsigned int color2, unsigned char alpha)
 Helper function for alpha blending two colors in the 32 bit X8R8G8B8 format.
__forceinline unsigned short RGBModulate16 (unsigned short color1, unsigned short color2)
 Helper function for multiplying two colors in the 16 bit R5G6B5 format.
__forceinline unsigned short RGBAdd16 (unsigned short color1, unsigned short color2)
__forceinline unsigned short RGBSubtract16 (unsigned short color1, unsigned short color2)
__forceinline unsigned short RGB16 (unsigned char r, unsigned char g, unsigned char b)
__forceinline unsigned int RGB32 (unsigned char r, unsigned char g, unsigned char b)
__forceinline unsigned int RGBA32 (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
__forceinline unsigned short RGB32TO16 (unsigned int color)
__forceinline unsigned int RGB16TO32 (unsigned short color)
__forceinline unsigned int RGB16TO32 (unsigned short color, unsigned char alpha)
__forceinline float CH_CLAMP (float i)
__forceinline unsigned char FLOATTO8 (float a)
__forceinline unsigned short FLOATTORGB16 (float r, float g, float b)
__forceinline unsigned int FLOATTORGB32 (float r, float g, float b)
__forceinline unsigned int FLOATTORGBA32 (float r, float g, float b, float a)
__forceinline float RGB16TOFLOATR (unsigned short color)
__forceinline float RGB16TOFLOATG (unsigned short color)
__forceinline float RGB16TOFLOATB (unsigned short color)
__forceinline float RGB32TOFLOATA (unsigned int color)
__forceinline float RGB32TOFLOATR (unsigned int color)
__forceinline float RGB32TOFLOATG (unsigned int color)
__forceinline float RGB32TOFLOATB (unsigned int color)

Detailed Description

Author:
Mattias Gustavsson
The ColorHelper.h file defines a bunch of functions which can be used to perform common color operations, such as calculating 32 or 16 bit color values given separate r, g and b components, or blend two colors using a specified blend factor.

Definition in file ColorHelper.h.


Define Documentation

#define MIN ( x,
 )     (x<y?x:y)

#define MAX ( x,
 )     (x>y?x:y)


Function Documentation

__forceinline unsigned short AlphaBlend16 ( unsigned short  color1,
unsigned short  color2,
unsigned char  alpha 
)

Helper function for alpha blending two colors in the 16 bit R5G6B5 format.

Definition at line 21 of file ColorHelper.h.

__forceinline unsigned int AlphaBlend32 ( unsigned int  color1,
unsigned int  color2,
unsigned char  alpha 
)

Helper function for alpha blending two colors in the 32 bit X8R8G8B8 format.

Definition at line 48 of file ColorHelper.h.

__forceinline unsigned short RGBModulate16 ( unsigned short  color1,
unsigned short  color2 
)

Helper function for multiplying two colors in the 16 bit R5G6B5 format.

Definition at line 63 of file ColorHelper.h.

__forceinline unsigned short RGBAdd16 ( unsigned short  color1,
unsigned short  color2 
)

Definition at line 76 of file ColorHelper.h.

__forceinline unsigned short RGBSubtract16 ( unsigned short  color1,
unsigned short  color2 
)

Definition at line 90 of file ColorHelper.h.

__forceinline unsigned short RGB16 ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)

Definition at line 104 of file ColorHelper.h.

__forceinline unsigned int RGB32 ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)

Definition at line 119 of file ColorHelper.h.

__forceinline unsigned int RGBA32 ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a 
)

Definition at line 135 of file ColorHelper.h.

__forceinline unsigned short RGB32TO16 ( unsigned int  color  ) 

Definition at line 153 of file ColorHelper.h.

__forceinline unsigned int RGB16TO32 ( unsigned short  color  ) 

Definition at line 166 of file ColorHelper.h.

__forceinline unsigned int RGB16TO32 ( unsigned short  color,
unsigned char  alpha 
)

Definition at line 177 of file ColorHelper.h.

__forceinline float CH_CLAMP ( float  i  ) 

Definition at line 190 of file ColorHelper.h.

__forceinline unsigned char FLOATTO8 ( float  a  ) 

Definition at line 206 of file ColorHelper.h.

__forceinline unsigned short FLOATTORGB16 ( float  r,
float  g,
float  b 
)

Definition at line 215 of file ColorHelper.h.

__forceinline unsigned int FLOATTORGB32 ( float  r,
float  g,
float  b 
)

Definition at line 228 of file ColorHelper.h.

__forceinline unsigned int FLOATTORGBA32 ( float  r,
float  g,
float  b,
float  a 
)

Definition at line 242 of file ColorHelper.h.

__forceinline float RGB16TOFLOATR ( unsigned short  color  ) 

Definition at line 256 of file ColorHelper.h.

__forceinline float RGB16TOFLOATG ( unsigned short  color  ) 

Definition at line 263 of file ColorHelper.h.

__forceinline float RGB16TOFLOATB ( unsigned short  color  ) 

Definition at line 270 of file ColorHelper.h.

__forceinline float RGB32TOFLOATA ( unsigned int  color  ) 

Definition at line 277 of file ColorHelper.h.

__forceinline float RGB32TOFLOATR ( unsigned int  color  ) 

Definition at line 285 of file ColorHelper.h.

__forceinline float RGB32TOFLOATG ( unsigned int  color  ) 

Definition at line 292 of file ColorHelper.h.

__forceinline float RGB32TOFLOATB ( unsigned int  color  ) 

Definition at line 299 of file ColorHelper.h.



Pixie University and the Pixie Game Engine is created and managed by Mattias Gustavsson.
Reproduction/republishing of any material on this site without permission is strictly prohibited.