diff options
Diffstat (limited to 'src/types')
-rw-r--r-- | src/types/output.c | 70 | ||||
-rw-r--r-- | src/types/output.h | 101 |
2 files changed, 171 insertions, 0 deletions
diff --git a/src/types/output.c b/src/types/output.c index 8576baa..80f3d36 100644 --- a/src/types/output.c +++ b/src/types/output.c @@ -125,6 +125,46 @@ size_t output_marshal(const struct output* restrict this, void* restrict buf) *(enum libgamma_decision*)(bs + off) = this->supported; off += sizeof(enum libgamma_decision); + if (bs != NULL) + *(enum colourspace*)(bs + off) = this->colourspace; + off += sizeof(enum colourspace); + + if (bs != NULL) + *(int*)(bs + off) = this->name_is_edid; + off += sizeof(int); + + if (bs != NULL) + *(unsigned*)(bs + off) = this->red_x; + off += sizeof(unsigned); + + if (bs != NULL) + *(unsigned*)(bs + off) = this->red_y; + off += sizeof(unsigned); + + if (bs != NULL) + *(unsigned*)(bs + off) = this->green_x; + off += sizeof(unsigned); + + if (bs != NULL) + *(unsigned*)(bs + off) = this->green_y; + off += sizeof(unsigned); + + if (bs != NULL) + *(unsigned*)(bs + off) = this->blue_x; + off += sizeof(unsigned); + + if (bs != NULL) + *(unsigned*)(bs + off) = this->blue_y; + off += sizeof(unsigned); + + if (bs != NULL) + *(unsigned*)(bs + off) = this->white_x; + off += sizeof(unsigned); + + if (bs != NULL) + *(unsigned*)(bs + off) = this->white_y; + off += sizeof(unsigned); + n = strlen(this->name) + 1; if (bs != NULL) memcpy(bs + off, this->name, n); @@ -179,6 +219,36 @@ size_t output_unmarshal(struct output* restrict this, const void* restrict buf) this->supported = *(const enum libgamma_decision*)(bs + off); off += sizeof(enum libgamma_decision); + this->colourspace = *(const enum colourspace*)(bs + off); + off += sizeof(enum colourspace); + + this->name_is_edid = *(const int*)(bs + off); + off += sizeof(int); + + this->red_x = *(const unsigned*)(bs + off); + off += sizeof(unsigned); + + this->red_y = *(const unsigned*)(bs + off); + off += sizeof(unsigned); + + this->green_x = *(const unsigned*)(bs + off); + off += sizeof(unsigned); + + this->green_y = *(const unsigned*)(bs + off); + off += sizeof(unsigned); + + this->blue_x = *(const unsigned*)(bs + off); + off += sizeof(unsigned); + + this->blue_y = *(const unsigned*)(bs + off); + off += sizeof(unsigned); + + this->white_x = *(const unsigned*)(bs + off); + off += sizeof(unsigned); + + this->white_y = *(const unsigned*)(bs + off); + off += sizeof(unsigned); + n = strlen(bs + off) + 1; this->name = memdup(bs + off, n); if (this->name == NULL) diff --git a/src/types/output.h b/src/types/output.h index f8a4c3e..95270ae 100644 --- a/src/types/output.h +++ b/src/types/output.h @@ -55,6 +55,49 @@ /** + * Colour spaces + */ +enum colourspace +{ + /** + * sRGB with explicit gamut + */ + COLOURSPACE_SRGB = 0, + + /** + * sRGB without explicit gamut + */ + COLOURSPACE_SRGB_SANS_GAMUT = 1, + + /** + * RGB (but not sRGB) with known gamut + */ + COLOURSPACE_RGB = 2, + + /** + * RGB (but not sRGB) without known gamut + */ + COLOURSPACE_RGB_SANS_GAMUT = 3, + + /** + * Non-RGB multicolour + */ + COLOURSPACE_NON_RGB = 4, + + /** + * Greyscale or monochrome + */ + COLOURSPACE_GREY = 5, + + /** + * Unknown + */ + COLOURSPACE_UNKNOWN = 6 +}; + + + +/** * Information about an output */ struct output @@ -75,6 +118,64 @@ struct output enum libgamma_decision supported; /** + * Whether the name is the EDID + */ + int name_is_edid; + + /** + * The monitor's colour space + */ + enum colourspace colourspace; + + /** + * 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; + + /** * The number of stops in the red gamma ramp */ size_t red_size; |