From 5a9b82bc5b9c5973ac9bda6c0ec4701c7fb88271 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 28 Aug 2014 15:32:01 +0200 Subject: add 8-bit ramps (good for software gamma) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/lib/libgamma-method.h | 74 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 2 deletions(-) (limited to 'src/lib/libgamma-method.h') diff --git a/src/lib/libgamma-method.h b/src/lib/libgamma-method.h index b549a5d..c342b43 100644 --- a/src/lib/libgamma-method.h +++ b/src/lib/libgamma-method.h @@ -861,6 +861,44 @@ typedef struct libgamma_crtc_information +/** + * Gamma ramp structure for 8-bit gamma ramps. + */ +typedef struct libgamma_gamma_ramps8 +{ + /** + * The size of `red`. + */ + size_t red_size; + + /** + * The size of `green`. + */ + size_t green_size; + + /** + * The size of `blue`. + */ + size_t blue_size; + + /** + * The gamma ramp for the red channel. + */ + uint8_t* red; + + /** + * The gamma ramp for the green channel. + */ + uint8_t* green; + + /** + * The gamma ramp for the blue channel. + */ + uint8_t* blue; + +} libgamma_gamma_ramps8_t; + + /** * Gamma ramp structure for 16-bit gamma ramps. */ @@ -1052,6 +1090,38 @@ typedef struct libgamma_gamma_rampsd +/** + * Initialise a gamma ramp in the proper way that allows all adjustment + * methods to read from and write to it without causing segmentation violation. + * + * The input must have `red_size`, `green_size` and `blue_size` set to the + * sizes of the gamma ramps that should be allocated. + * + * @param this The gamma ramps. + * @return Zero on success, -1 on allocation error, `errno` will be set accordingly. + */ +int libgamma_gamma_ramps8_initialise(libgamma_gamma_ramps8_t* restrict this); + +/** + * Release resources that are held by a gamma ramp strcuture that + * has been allocated by `libgamma_gamma_ramps8_initialise` or otherwise + * initialises in the proper manner. + * + * @param this The gamma ramps. + */ +void libgamma_gamma_ramps8_destroy(libgamma_gamma_ramps8_t* restrict this); + +/** + * Release resources that are held by a gamma ramp strcuture that + * has been allocated by `libgamma_gamma_ramps8_initialise` or otherwise + * initialises in the proper manner, as well as release the pointer + * to the structure. + * + * @param this The gamma ramps. + */ +void libgamma_gamma_ramps8_free(libgamma_gamma_ramps8_t* restrict this); + + /** * Initialise a gamma ramp in the proper way that allows all adjustment * methods to read from and write to it without causing segmentation violation. @@ -1066,7 +1136,7 @@ int libgamma_gamma_ramps16_initialise(libgamma_gamma_ramps16_t* restrict this); /** * Release resources that are held by a gamma ramp strcuture that - * has been allocated by `libgamma_gamma_ramps_initialise` or otherwise + * has been allocated by `libgamma_gamma_ramps16_initialise` or otherwise * initialises in the proper manner. * * @param this The gamma ramps. @@ -1075,7 +1145,7 @@ void libgamma_gamma_ramps16_destroy(libgamma_gamma_ramps16_t* restrict this); /** * Release resources that are held by a gamma ramp strcuture that - * has been allocated by `libgamma_gamma_ramps_initialise` or otherwise + * has been allocated by `libgamma_gamma_ramps16_initialise` or otherwise * initialises in the proper manner, as well as release the pointer * to the structure. * -- cgit v1.2.3-70-g09d2