MTek-GDL 0.100.4-muffintrap
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Enumerator | Functions | Variables
Color Handling Macros

Macros for handling 32-bit color values. More...

Data Structures

struct  Color4f
 
struct  Color4b
 

Macros

#define RED(c)   (((c)>>24)&0xFF)
 
#define GREEN(c)   (((c)>>16)&0xFF)
 
#define BLUE(c)   (((c)>>8)&0xFF)
 
#define ALPHA(c)   ((c) &0xFF)
 
#define TO_RGBA(r, g, b, a)
 
#define TO_IA(i, a)   (i&0xff)|((a&0xff)<<8)
 

Typedefs

typedef struct Color4f Color4f
 
typedef struct Color4b Color4b
 
typedef enum DefaultColor DefaultColor
 

Enumerations

enum  DefaultColor {
  Color_White , Color_Black , Color_Red , Color_Green ,
  Color_Blue
}
 

Functions

Color4f Color_Create4f (float red, float green, float blue, float alpha)
 
Color4f Color_CreateFromPointer4f (Color4f *color)
 
Color4b Color_Create4b (u8 red, u8 green, u8 blue, u8 alpha)
 
Color4f Color_HexToFloats (u32 color)
 
Color4b Color_HexToBytes (u32 color)
 
u32 Color_FloatsToHex (Color4f components)
 
Color4fColor_GetDefaultColor (DefaultColor color)
 

Variables

GLfloat Color4f::red
 
GLfloat Color4f::green
 
GLfloat Color4f::blue
 
GLfloat Color4f::alpha
 
u8 Color4b::red
 
u8 Color4b::green
 
u8 Color4b::blue
 
u8 Color4b::alpha
 

Detailed Description

Macros for handling 32-bit color values.

Macro Definition Documentation

◆ ALPHA

#define ALPHA (   c)    ((c) &0xFF)

Gets the alpha component intensity from a 32-bit color value.

Parameters
[in]c32-bit RGBA color value
Returns
Alpha component of value

◆ BLUE

#define BLUE (   c)    (((c)>>8)&0xFF)

Gets the blue component intensity from a 32-bit color value

Parameters
[in]c32-bit RGBA color value
Returns
Blue component of value

◆ GREEN

#define GREEN (   c)    (((c)>>16)&0xFF)

Gets the green component intensity from a 32-bit color value.

Parameters
[in]c32-bit RGBA color value
Returns
Green component of value

◆ RED

#define RED (   c)    (((c)>>24)&0xFF)

Gets the red component intensity from a 32-bit color value.

Parameters
[in]c32-bit RGBA color value
Returns
Red component of value

◆ TO_IA

#define TO_IA (   i,
 
)    (i&0xff)|((a&0xff)<<8)

< Constructs a 32-bit RGBA color value.

Parameters
[in]rRed component
[in]gGreen component
[in]bBlue component
[in]aAlpha component
Returns
32-bit color value Constructs a 16-bit intensity with alpha value.
Parameters
[in]iIntensity component
[in]aAlpha component
Returns
16-bit intensity with alpha value

◆ TO_RGBA

#define TO_RGBA (   r,
  g,
  b,
 
)
Value:
((u32)((((u32)(r))<<24) | \
((((u32)(g))&0xFF)<<16) | \
((((u32)(b))&0xFF)<<8) | \
(((u32)(a))&0xFF)))