bx-lib : the Basic X11 Library tuned for C beginners
1.0
|
Functions | |
bx_color | bx_rgb_to_color (unsigned char r, unsigned char g, unsigned char b) |
bx_color | bx_mean_color (bx_color c1, bx_color c2) |
bx_color | bx_blend_color (bx_color c1, double alpha, bx_color c2) |
bx_color bx_rgb_to_color | ( | unsigned char | r, |
unsigned char | g, | ||
unsigned char | b | ||
) |
Returns the color suported by the system that best approximates a given RGB (Red,Green,Blue) triplet. The three channels are in the range from 0 to 255 (or from 0x00 to 0xFF in hexadecimal base).
r | the red channel, in the range from 0x00 to 0xFF (saturated). |
g | the green channel, in the range from 0x00 to 0xFF(saturated). |
b | the blue channel, in the range from 0x00 to 0xFF (saturated). |
Computes an approximation of the color c averaging two colors c1 and c2, that is if c1=(r1,g1,b1) and c2=(r2,g2,b2) as (Red,Green,Blue) triplets, then c=((r1+r2)/2, (g1+g2)/2,(b1+b2)/2).
c1 | the first color. |
c2 | the second color. |
Computes an approximation of the color c of an alpha-weighted blend of two colors c1 and c2, that is if c1=(r1,g1,b1) and c2=(r2,g2,b2) as (Red,Green,Blue) triplets, then c=(r1+(r2-r1)*alpha, g1+(g2-g1)*alpha, b1+(b2-b1)*alpha) for some given alpha in the range (0.0, 1.0).
c1 | the first color. |
c2 | the second color. |
alpha | a blending coefficient in the range (0.0, 1.0). |