From 39f6be3f64a6c5c0a1ec0ee8a1d905160381b71f Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Sat, 27 Jan 2024 21:42:24 +0100 Subject: WIP: Thread-safe colour management --- fiv-io.h | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'fiv-io.h') diff --git a/fiv-io.h b/fiv-io.h index bb92033..26e1b93 100644 --- a/fiv-io.h +++ b/fiv-io.h @@ -28,7 +28,7 @@ typedef struct _FivIoImage FivIoImage; // --- Colour management ------------------------------------------------------- -void fiv_io_profile_init(void); +void fiv_io_cmm_init(void); // TODO(p): Make it also possible to use Skia's skcms. typedef void *FivIoProfile; @@ -43,23 +43,42 @@ void fiv_io_profile_free(FivIoProfile *self); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +#define FIV_TYPE_IO_CMM (fiv_io_cmm_get_type()) +G_DECLARE_FINAL_TYPE(FivIoCmm, fiv_io_cmm, FIV, CMM, GObject) + +FivIoCmm *fiv_io_cmm_get_default(); + +/* +FivIoProfile *fiv_io_cmm_get_profile( + FivIoCmm *self, const void *data, size_t len); +FivIoProfile *fiv_io_cmm_get_profile_from_bytes(FivIoCmm *self, GBytes *bytes); +FivIoProfile *fiv_io_cmm_get_profile_sRGB(FivIoCmm *self); +FivIoProfile *fiv_io_cmm_get_profile_sRGB_gamma(FivIoCmm *self, double gamma); +FivIoProfile *fiv_io_cmm_get_profile_parametric( + FivIoCmm *self, double gamma, double whitepoint[2], double primaries[6]); +*/ + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + void fiv_io_premultiply_argb32(FivIoImage *image); -void fiv_io_profile_cmyk( +void fiv_io_cmm_cmyk(FivIoCmm *self, FivIoImage *image, FivIoProfile *source, FivIoProfile *target); -void fiv_io_profile_4x16le_direct(unsigned char *data, +void fiv_io_cmm_4x16le_direct(FivIoCmm *self, unsigned char *data, int w, int h, FivIoProfile *source, FivIoProfile *target); -void fiv_io_profile_argb32_premultiply( +void fiv_io_cmm_argb32_premultiply(FivIoCmm *self, FivIoImage *image, FivIoProfile *source, FivIoProfile *target); -void fiv_io_profile_page(FivIoImage *page, FivIoProfile *target, - void (*frame_cb) (FivIoImage *, FivIoProfile *, FivIoProfile *)); -#define fiv_io_profile_argb32_premultiply_page(page, target) \ - fiv_io_profile_page((page), (target), fiv_io_profile_argb32_premultiply) +void fiv_io_cmm_page(FivIoCmm *self, FivIoImage *page, FivIoProfile *target, + void (*frame_cb) (FivIoCmm *, + FivIoImage *, FivIoProfile *, FivIoProfile *)); +#define fiv_io_cmm_argb32_premultiply_page(cmm, page, target) \ + fiv_io_cmm_page((cmm), (page), (target), fiv_io_cmm_argb32_premultiply) -void fiv_io_profile_any( +void fiv_io_cmm_any(FivIoCmm *self, FivIoImage *image, FivIoProfile *source, FivIoProfile *target); -FivIoImage *fiv_io_profile_finalize(FivIoImage *image, FivIoProfile *target); +FivIoImage *fiv_io_cmm_finalize( + FivIoCmm *self, FivIoImage *image, FivIoProfile *target); // --- Loading ----------------------------------------------------------------- -- cgit v1.2.3-70-g09d2