aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/skcms/skcms.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/skcms/skcms.h')
-rw-r--r--third_party/skcms/skcms.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/third_party/skcms/skcms.h b/third_party/skcms/skcms.h
index 79d0abf5cd..0451a582e3 100644
--- a/third_party/skcms/skcms.h
+++ b/third_party/skcms/skcms.h
@@ -16,6 +16,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+#include <string.h>
#ifdef __cplusplus
extern "C" {
@@ -238,6 +239,28 @@ SKCMS_API bool skcms_PrimariesToXYZD50(float rx, float ry,
float wx, float wy,
skcms_Matrix3x3* toXYZD50);
+// Utilities for programmatically constructing profiles
+static inline void skcms_Init(skcms_ICCProfile* p) {
+ memset(p, 0, sizeof(*p));
+ p->data_color_space = skcms_Signature_RGB;
+ p->pcs = skcms_Signature_XYZ;
+}
+
+static inline void skcms_SetTransferFunction(skcms_ICCProfile* p,
+ const skcms_TransferFunction* tf) {
+ p->has_trc = true;
+ for (int i = 0; i < 3; ++i) {
+ p->trc[i].table_entries = 0;
+ p->trc[i].parametric = *tf;
+ p->has_poly_tf[i] = false;
+ }
+}
+
+static inline void skcms_SetXYZD50(skcms_ICCProfile* p, const skcms_Matrix3x3* m) {
+ p->has_toXYZD50 = true;
+ p->toXYZD50 = *m;
+}
+
#ifdef __cplusplus
}
#endif