Loading...
Searching...
No Matches
Color.h File Reference

Go to the source code of this file.

Classes

struct  sfColor
 Utility class for manpulating RGBA colors. More...
 

Functions

sfColor sfColor_fromRGB (uint8_t red, uint8_t green, uint8_t blue)
 Construct a color from its 3 RGB components.
 
sfColor sfColor_fromRGBA (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
 Construct a color from its 4 RGBA components.
 
sfColor sfColor_fromInteger (uint32_t color)
 Construct the color from 32-bit unsigned integer.
 
uint32_t sfColor_toInteger (sfColor color)
 Convert a color to a 32-bit unsigned integer.
 
sfColor sfColor_add (sfColor color1, sfColor color2)
 Add two colors.
 
sfColor sfColor_subtract (sfColor color1, sfColor color2)
 Subtract two colors.
 
sfColor sfColor_modulate (sfColor color1, sfColor color2)
 Modulate two colors.
 

Variables

const sfColor sfBlack
 Black predefined color.
 
const sfColor sfWhite
 White predefined color.
 
const sfColor sfRed
 Red predefined color.
 
const sfColor sfGreen
 Green predefined color.
 
const sfColor sfBlue
 Blue predefined color.
 
const sfColor sfYellow
 Yellow predefined color.
 
const sfColor sfMagenta
 Magenta predefined color.
 
const sfColor sfCyan
 Cyan predefined color.
 
const sfColor sfTransparent
 Transparent (black) predefined color.
 

Function Documentation

◆ sfColor_add()

sfColor sfColor_add ( sfColor  color1,
sfColor  color2 
)

Add two colors.

Parameters
color1First color
color2Second color
Returns
Component-wise saturated addition of the two colors

◆ sfColor_fromInteger()

sfColor sfColor_fromInteger ( uint32_t  color)

Construct the color from 32-bit unsigned integer.

Parameters
colorNumber containing the RGBA components (in that order)
Returns
sfColor constructed from the 32-bit unsigned integer

◆ sfColor_fromRGB()

sfColor sfColor_fromRGB ( uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

Construct a color from its 3 RGB components.

Parameters
redRed component (0 .. 255)
greenGreen component (0 .. 255)
blueBlue component (0 .. 255)
Returns
sfColor constructed from the components

◆ sfColor_fromRGBA()

sfColor sfColor_fromRGBA ( uint8_t  red,
uint8_t  green,
uint8_t  blue,
uint8_t  alpha 
)

Construct a color from its 4 RGBA components.

Parameters
redRed component (0 .. 255)
greenGreen component (0 .. 255)
blueBlue component (0 .. 255)
alphaAlpha component (0 .. 255)
Returns
sfColor constructed from the components

◆ sfColor_modulate()

sfColor sfColor_modulate ( sfColor  color1,
sfColor  color2 
)

Modulate two colors.

Parameters
color1First color
color2Second color
Returns
Component-wise multiplication of the two colors

◆ sfColor_subtract()

sfColor sfColor_subtract ( sfColor  color1,
sfColor  color2 
)

Subtract two colors.

Parameters
color1First color
color2Second color
Returns
Component-wise saturated subtraction of the two colors

◆ sfColor_toInteger()

uint32_t sfColor_toInteger ( sfColor  color)

Convert a color to a 32-bit unsigned integer.

Returns
Color represented as a 32-bit unsigned integer

Variable Documentation

◆ sfBlack

const sfColor sfBlack

Black predefined color.

Definition at line 46 of file Color.h.

◆ sfBlue

const sfColor sfBlue

Blue predefined color.

Definition at line 50 of file Color.h.

◆ sfCyan

const sfColor sfCyan

Cyan predefined color.

Definition at line 53 of file Color.h.

◆ sfGreen

const sfColor sfGreen

Green predefined color.

Definition at line 49 of file Color.h.

◆ sfMagenta

const sfColor sfMagenta

Magenta predefined color.

Definition at line 52 of file Color.h.

◆ sfRed

const sfColor sfRed

Red predefined color.

Definition at line 48 of file Color.h.

◆ sfTransparent

const sfColor sfTransparent

Transparent (black) predefined color.

Definition at line 54 of file Color.h.

◆ sfWhite

const sfColor sfWhite

White predefined color.

Definition at line 47 of file Color.h.

◆ sfYellow

const sfColor sfYellow

Yellow predefined color.

Definition at line 51 of file Color.h.