codac
codac_colors.h
Go to the documentation of this file.
1 
12 #ifndef __CODAC_COLORS_H__
13 #define __CODAC_COLORS_H__
14 
15 #include <string>
16 
17 namespace codac
18 {
23  typedef struct
24  {
25  float r;
26  float g;
27  float b;
28  float alpha;
29  } rgb;
30 
35  typedef struct
36  {
37  float h;
38  float s;
39  float v;
40  float alpha;
41  } hsv;
42 
50  const std::string rgb2hex(rgb rgb_value, const char* prefix = "#");
51 
58  rgb hsv2rgb(hsv hsv_value);
59 
66  hsv rgb2hsv(rgb rgb_value);
67 
77  rgb make_rgb(int r, int g, int b, int alpha = 255);
78 
88  rgb make_rgb(float r, float g, float b, float alpha = 1.);
89 
99  hsv make_hsv(int h, int s, int v, int alpha = 100);
100 
110  hsv make_hsv(float h, float s, float v, float alpha = 1.);
111 }
112 
113 #endif
float h
hue, angle value in degrees between 0. and 360.
Definition: codac_colors.h:37
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition: codac_capd_helpers.h:9
float s
saturation, a value between 0. and 1.
Definition: codac_colors.h:38
rgb make_rgb(int r, int g, int b, int alpha=255)
Makes an RGV value from integers.
const std::string rgb2hex(rgb rgb_value, const char *prefix="#")
Represents an RGB value in a HTML standard.
hsv make_hsv(int h, int s, int v, int alpha=100)
Makes an HSV value from integers.
float alpha
opacity, value between 0. (transparent) and 1. (opaque)
Definition: codac_colors.h:28
float alpha
opacity, value between 0. (transparent) and 1. (opaque)
Definition: codac_colors.h:40
Represents an RGB value.
Definition: codac_colors.h:23
float g
green, value between 0. and 1.
Definition: codac_colors.h:26
float b
blue, value between 0. and 1.
Definition: codac_colors.h:27
float r
red, value between 0. and 1.
Definition: codac_colors.h:25
rgb hsv2rgb(hsv hsv_value)
Converts HSV to RGB.
hsv rgb2hsv(rgb rgb_value)
Converts RGB to HSV.
Represents an HSV value.
Definition: codac_colors.h:35
float v
value (lightness), a value between 0. and 1.
Definition: codac_colors.h:39