diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcoopgamma.c | 22 | ||||
-rw-r--r-- | src/libcoopgamma.h | 107 |
2 files changed, 129 insertions, 0 deletions
diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c index 1beeb8a..726ee8c 100644 --- a/src/libcoopgamma.c +++ b/src/libcoopgamma.c @@ -410,12 +410,23 @@ size_t libcoopgamma_crtc_info_marshal(const libcoopgamma_crtc_info_t* restrict t marshal_version(LIBCOOPGAMMA_CRTC_INFO_VERSION); marshal_version(LIBCOOPGAMMA_DEPTH_VERSION); marshal_version(LIBCOOPGAMMA_SUPPORT_VERSION); + marshal_version(LIBCOOPGAMMA_COLOURSPACE_VERSION); marshal_prim(this->cooperative, int); marshal_prim(this->depth, libcoopgamma_depth_t); marshal_prim(this->red_size, size_t); marshal_prim(this->green_size, size_t); marshal_prim(this->blue_size, size_t); marshal_prim(this->supported, libcoopgamma_support_t); + marshal_prim(this->colourspace, libcoopgamma_colourspace_t); + marshal_prim(this->have_gamut, int); + marshal_prim(this->red_x, unsigned); + marshal_prim(this->red_y, unsigned); + marshal_prim(this->green_x, unsigned); + marshal_prim(this->green_y, unsigned); + marshal_prim(this->blue_x, unsigned); + marshal_prim(this->blue_y, unsigned); + marshal_prim(this->white_x, unsigned); + marshal_prim(this->white_y, unsigned); MARSHAL_EPILOGUE; } @@ -436,12 +447,23 @@ int libcoopgamma_crtc_info_unmarshal(libcoopgamma_crtc_info_t* restrict this, unmarshal_version(LIBCOOPGAMMA_CRTC_INFO_VERSION); unmarshal_version(LIBCOOPGAMMA_DEPTH_VERSION); unmarshal_version(LIBCOOPGAMMA_SUPPORT_VERSION); + unmarshal_version(LIBCOOPGAMMA_COLOURSPACE_VERSION); unmarshal_prim(this->cooperative, int); unmarshal_prim(this->depth, libcoopgamma_depth_t); unmarshal_prim(this->red_size, size_t); unmarshal_prim(this->green_size, size_t); unmarshal_prim(this->blue_size, size_t); unmarshal_prim(this->supported, libcoopgamma_support_t); + unmarshal_prim(this->colourspace, libcoopgamma_colourspace_t); + unmarshal_prim(this->have_gamut, int); + unmarshal_prim(this->red_x, unsigned); + unmarshal_prim(this->red_y, unsigned); + unmarshal_prim(this->green_x, unsigned); + unmarshal_prim(this->green_y, unsigned); + unmarshal_prim(this->blue_x, unsigned); + unmarshal_prim(this->blue_y, unsigned); + unmarshal_prim(this->white_x, unsigned); + unmarshal_prim(this->white_y, unsigned); UNMARSHAL_EPILOGUE; } diff --git a/src/libcoopgamma.h b/src/libcoopgamma.h index 657592b..a4a21e5 100644 --- a/src/libcoopgamma.h +++ b/src/libcoopgamma.h @@ -97,6 +97,13 @@ /** * Number used to identify implementation + * version of `libcoopgamma_colourspace_t`, if it + * is ever modified, this number is increased + */ +#define LIBCOOPGAMMA_COLOURSPACE_VERSION 0 + +/** + * Number used to identify implementation * version of `libcoopgamma_ramps*_t`, if they * are ever modified, this number is increased */ @@ -263,6 +270,42 @@ typedef enum libcoopgamma_lifespan /** + * Colourspaces + */ +typedef enum libcoopgamma_colourspace +{ + /** + * The colourspace is unknown + * + * This value will always be 0 + */ + LIBCOOPGAMMA_UNKNOWN = 0, + + /** + * sRGB (Standard RGB) + */ + LIBCOOPGAMMA_SRGB = 1, + + /** + * RGB other than sRGB + */ + LIBCOOPGAMMA_RGB = 2, + + /** + * Non-RGB multicolour + */ + LIBCOOPGAMMA_NON_RGB = 3, + + /** + * Monochrome, greyscale, or some + * other singlecolour scale + */ + LIBCOOPGAMMA_GREY = 4 + +} libcoopgamma_colourspace_t; + + +/** * Define a gamma ramp structure * * @param suffix:identifier The end of the name of the `struct` @@ -471,6 +514,70 @@ typedef struct libcoopgamma_crtc_info */ size_t blue_size; + /** + * The monitor's colurspace + */ + libcoopgamma_colourspace_t colourspace; + + /** + * Whether `.red_x`, `.red_y`, `.green_x`, + * `.green_y`, `.blue_x`, `.blue_y`, + * `.white_x`, and `.white_y` are set. + * + * If this is true, but the colourspace + * is not RGB (or sRGB), there is something + * wrong. Please also check the colourspace. + */ + int have_gamut; + + /** + * The x-value (CIE xyY) of the monitor's + * red colour, multiplied by 1024 + */ + unsigned red_x; + + /** + * The y-value (CIE xyY) of the monitor's + * red colour, multiplied by 1024 + */ + unsigned red_y; + + /** + * The x-value (CIE xyY) of the monitor's + * green colour, multiplied by 1024 + */ + unsigned green_x; + + /** + * The y-value (CIE xyY) of the monitor's + * green colour, multiplied by 1024 + */ + unsigned green_y; + + /** + * The x-value (CIE xyY) of the monitor's + * blue colour, multiplied by 1024 + */ + unsigned blue_x; + + /** + * The y-value (CIE xyY) of the monitor's + * blue colour, multiplied by 1024 + */ + unsigned blue_y; + + /** + * The x-value (CIE xyY) of the monitor's + * default white point, multiplied by 1024 + */ + unsigned white_x; + + /** + * The y-value (CIE xyY) of the monitor's + * default white point, multiplied by 1024 + */ + unsigned white_y; + } libcoopgamma_crtc_info_t; |