1.1.0
Classes | Functions | Variables
Color

All the functions and types that deal with font colors. More...

Classes

struct  fc_color
 Represents a 4-byte-per-pixel color with red, green, blue and alpha components. More...
 
struct  fc::color
 A wrapper class for fc_color. More...
 

Functions

void fc_color_construct (struct fc_color *color)
 Zeroes all fields of a fc_color structure. More...
 
void fc_color_set (struct fc_color *color, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
 Sets all fields of a fc_color structure at once. More...
 
struct fc_color fc_rgba (uint8_t r, uint8_t g, uint8_t b, uint8_t a)
 Constructs and return a fc_color value with the provided components set. More...
 
struct fc_color fc_rgb (uint8_t r, uint8_t g, uint8_t b)
 Constructs and return a fc_color value with the provided components set and alpha set as 255 (opaque) More...
 
struct fc_color fc_0xrgb (uint32_t color)
 Constructs and return a fc_color value with red, green and blue components extracted from an unsigned 32-bit integer, sets alpha to 255. More...
 
struct fc_color fc_0xrgba (uint32_t color)
 Constructs and return a fc_color value with red, green and blue components extracted from an unsigned 32-bit integer. More...
 

Variables

struct fc_color const fc_color_red
 RGBA: #FF0000FF
 
struct fc_color const fc_color_green
 RGBA: #00FF00FF
 
struct fc_color const fc_color_blue
 RGBA: #0000FFFF
 
struct fc_color const fc_color_white
 RGBA: #FFFFFFFF
 
struct fc_color const fc_color_black
 RGBA: #000000FF
 

Detailed Description

All the functions and types that deal with font colors.

Function Documentation

◆ fc_color_construct()

void fc_color_construct ( struct fc_color color)

Zeroes all fields of a fc_color structure.

Note that simply using struct fc_color color = {} is equivalent and faster.

Example

struct fc_color color;
Parameters
colorA pointer to a fc_color value

◆ fc_color_set()

void fc_color_set ( struct fc_color color,
uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a 
)

Sets all fields of a fc_color structure at once.

Example

struct fc_color my_red = fc_color_red;
fc_color_set(&my_red, 255, 100, 100, 255);
Parameters
colorA pointer to a fc_color value to be set
rThe red component to be set
gThe green component to be set
bThe blue component to be set
aThe alpha component to be set

◆ fc_rgba()

struct fc_color fc_rgba ( uint8_t  r,
uint8_t  g,
uint8_t  b,
uint8_t  a 
)

Constructs and return a fc_color value with the provided components set.

Example

struct fc_color translucent_red = fc_rgba(255, 0, 0, 128);
Parameters
rThe red component
gThe green component
bThe blue component
aThe alpha component
Returns
A fc_color value with the components set

◆ fc_rgb()

struct fc_color fc_rgb ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

Constructs and return a fc_color value with the provided components set and alpha set as 255 (opaque)

Example

struct fc_color red = fc_rgb(255, 0, 0);
Parameters
rThe red component
gThe green component
bThe blue component
Returns
A fc_color value with the components set and alpha set to 255

◆ fc_0xrgb()

struct fc_color fc_0xrgb ( uint32_t  color)

Constructs and return a fc_color value with red, green and blue components extracted from an unsigned 32-bit integer, sets alpha to 255.

Example

struct fc_color red = fc_0xrgb(0xFF0000);
Parameters
colorThe color encoded as 32-bit unsigned integer to use
Returns
A fc_color value with the components extracted from the integer and alpha set to 255

◆ fc_0xrgba()

struct fc_color fc_0xrgba ( uint32_t  color)

Constructs and return a fc_color value with red, green and blue components extracted from an unsigned 32-bit integer.

Example

struct fc_color red = fc_0xrgba(0xFF000080);
Parameters
colorThe color encoded as 32-bit unsigned integer to use
Returns
A fc_color value with the components extracted from the integer
fc_rgba
struct fc_color fc_rgba(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
Constructs and return a fc_color value with the provided components set.
fc_color_red
struct fc_color const fc_color_red
RGBA: #FF0000FF
fc_rgb
struct fc_color fc_rgb(uint8_t r, uint8_t g, uint8_t b)
Constructs and return a fc_color value with the provided components set and alpha set as 255 (opaque)
fc_color
Represents a 4-byte-per-pixel color with red, green, blue and alpha components.
Definition: color.h:25
fc_0xrgba
struct fc_color fc_0xrgba(uint32_t color)
Constructs and return a fc_color value with red, green and blue components extracted from an unsigned...
fc_color_set
void fc_color_set(struct fc_color *color, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
Sets all fields of a fc_color structure at once.
fc_0xrgb
struct fc_color fc_0xrgb(uint32_t color)
Constructs and return a fc_color value with red, green and blue components extracted from an unsigned...
fc_color_construct
void fc_color_construct(struct fc_color *color)
Zeroes all fields of a fc_color structure.