colrcv  v0.5.0
C Library for converting Colours between different Colour Models
rgb.h
Go to the documentation of this file.
1 /*
2  * This source file forms part of colrcv
3  * colrcv is a C Library for converting Colours between different Colour Models.
4  */
5 
24 #ifndef SAXBOPHONE_COLRCV_MODELS_RGB_H
25 #define SAXBOPHONE_COLRCV_MODELS_RGB_H
26 
27 #include <stdbool.h>
28 
29 #include "types.h"
30 
31 
32 #ifdef __cplusplus
33 extern "C"{
34 #endif
35 
42 struct colrcv_rgb_t {
44  double r;
46  double g;
48  double b;
49 };
50 
55 extern const double COLRCV_RGB_MIN_VALUE;
56 
61 extern const double COLRCV_RGB_MAX_VALUE;
62 
70 
78 
86 
94 
103 
112 
121 
130 
138 
146 
154 
162 
163 #ifdef __cplusplus
164 } // extern "C"
165 #endif
166 
167 // end of header file
168 #endif
Used to represent an XYZ colour.
Definition: xyz.h:43
This header file forward-declares (via typedef) all the data types used to represent colours in diffe...
bool colrcv_rgb_g_is_valid(colrcv_rgb_t rgb)
Checks that green component of a given colrcv_rgb_t struct is valid.
Definition: rgb.c:35
colrcv_rgb_t colrcv_rgb_clamp_b(colrcv_rgb_t rgb)
Makes the blue channel of a given colrcv_rgb_t struct fit within the &#39;standard&#39; range for that channe...
Definition: rgb.c:73
bool colrcv_rgb_r_is_valid(colrcv_rgb_t rgb)
Checks that red component of a given colrcv_rgb_t struct is valid.
Definition: rgb.c:29
colrcv_lab_t colrcv_rgb_to_lab(colrcv_rgb_t rgb)
Converts an RGB colour to a LAB colour.
Definition: rgb.c:182
colrcv_hsv_t colrcv_rgb_to_hsv(colrcv_rgb_t rgb)
Converts an RGB colour to a HSV colour.
Definition: rgb.c:128
colrcv_rgb_t colrcv_rgb_clamp(colrcv_rgb_t rgb)
Makes all of the channels of a given colrcv_rgb_t struct fit within the &#39;standard&#39; range for that cha...
Definition: rgb.c:56
colrcv_xyz_t colrcv_rgb_to_xyz(colrcv_rgb_t rgb)
Converts an RGB colour to an XYZ colour.
Definition: rgb.c:196
colrcv_rgb_t colrcv_rgb_clamp_r(colrcv_rgb_t rgb)
Makes the red channel of a given colrcv_rgb_t struct fit within the &#39;standard&#39; range for that channel...
Definition: rgb.c:61
bool colrcv_rgb_is_valid(colrcv_rgb_t rgb)
Checks that the components of a given colrcv_rgb_t struct are valid.
Definition: rgb.c:47
double r
The red component. Should be in range 0 -> 255.
Definition: rgb.h:44
const double COLRCV_RGB_MIN_VALUE
Definition: rgb.c:26
Used to represent a HSV colour.
Definition: hsv.h:41
double b
The blue component. Should be in range 0 -> 255.
Definition: rgb.h:48
bool colrcv_rgb_b_is_valid(colrcv_rgb_t rgb)
Checks that blue component of a given colrcv_rgb_t struct is valid.
Definition: rgb.c:41
colrcv_rgb_t colrcv_rgb_clamp_g(colrcv_rgb_t rgb)
Makes the green channel of a given colrcv_rgb_t struct fit within the &#39;standard&#39; range for that chann...
Definition: rgb.c:67
double g
The green component. Should be in range 0 -> 255.
Definition: rgb.h:46
colrcv_hsl_t colrcv_rgb_to_hsl(colrcv_rgb_t rgb)
Converts an RGB colour to a HSL colour.
Definition: rgb.c:152
Used to represent a HSL colour.
Definition: hsl.h:41
Used to represent a LAB colour.
Definition: lab.h:41
Used to represent an RGB colour.
Definition: rgb.h:42
const double COLRCV_RGB_MAX_VALUE
Definition: rgb.c:27