extract colors to ptk_color.h and add HSV

This commit is contained in:
jacekpoz 2024-08-13 18:57:54 +02:00
parent 061e5799f9
commit b8b2698434
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
3 changed files with 61 additions and 28 deletions

View file

@ -1,6 +1,7 @@
#ifndef PTK_PTK_H_ #ifndef PTK_PTK_H_
#define PTK_PTK_H_ #define PTK_PTK_H_
#include <ptk_color.h>
#include <ptk_list.h> #include <ptk_list.h>
#include <ptk_vec.h> #include <ptk_vec.h>

60
include/ptk_color.h Normal file
View file

@ -0,0 +1,60 @@
#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;
};
} PtkColor;
typedef union {
struct {
float h;
float s;
float v;
};
struct {
float hue;
float saturation;
float value;
};
} PtkHSV;
typedef union {
struct {
float r;
float g;
float b;
float a;
};
struct {
float red;
float green;
float blue;
float alpha;
};
} PtkColorA;
typedef union {
struct {
float h;
float s;
float v;
float a;
};
struct {
float hue;
float saturation;
float value;
float alpha;
};
} PtkHSVA;
#endif // PTK_PTK_COLOR_H_

View file

@ -25,19 +25,6 @@ typedef struct {
float z; float z;
} PtkVec3; } PtkVec3;
typedef union {
struct {
float r;
float g;
float b;
};
struct {
float red;
float green;
float blue;
};
} PtkColor;
typedef struct { typedef struct {
float x; float x;
float y; float y;
@ -45,19 +32,4 @@ typedef struct {
float w; float w;
} PtkVec4; } PtkVec4;
typedef union {
struct {
float r;
float g;
float b;
float a;
};
struct {
float red;
float green;
float blue;
float alpha;
};
} PtkColorA;
#endif // PTK_PTK_VEC_H_ #endif // PTK_PTK_VEC_H_