ptk/include/ptk_color.h
2024-08-14 00:09:32 +02:00

68 lines
1.1 KiB
C

#ifndef PTK_PTK_COLOR_H_
#define PTK_PTK_COLOR_H_
// all values in range [0.0, 1.0]
typedef union {
struct {
float r;
float g;
float b;
};
struct {
float red;
float green;
float blue;
};
} PtkRGB;
typedef union {
struct {
float r;
float g;
float b;
float a;
};
struct {
float red;
float green;
float blue;
float alpha;
};
} 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_