ptk/include/ptk_color.h

68 lines
1.1 KiB
C
Raw Normal View History

#ifndef PTK_PTK_COLOR_H_
#define PTK_PTK_COLOR_H_
typedef union {
struct {
float r;
float g;
float b;
};
struct {
float red;
float green;
float blue;
};
2024-08-13 18:59:52 +02:00
} PtkRGB;
typedef union {
struct {
float r;
float g;
float b;
float a;
};
struct {
float red;
float green;
float blue;
float alpha;
};
2024-08-13 18:59:52 +02:00
} PtkRGBA;
// all values in range [0.0, 360.0]
typedef union {
struct {
float h;
float s;
float v;
};
struct {
float hue;
float saturation;
float value;
};
} PtkHSV;
typedef union {
struct {
float h;
float s;
float v;
float a;
};
struct {
float hue;
float saturation;
float value;
float alpha;
};
} PtkHSVA;
PtkHSV ptk_rgb_to_hsv(const PtkRGB rgb);
PtkRGB ptk_hsv_to_rgb(const PtkHSV hsv);
PtkHSVA ptk_rgba_to_hsva(const PtkRGBA rgba);
PtkRGBA ptk_hsva_to_rgba(const PtkHSVA hsva);
#endif // PTK_PTK_COLOR_H_