diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-05-28 18:05:05 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-05-28 18:05:05 -0600 |
commit | efd3c1c2b42ffda0c8f7e5cd9b03fba07eead1ea (patch) | |
tree | c522f2bafe5def3eb68a79005c049e130ef76b24 /libdimension/dimension | |
parent | 1bf306d4d93cc21c220a3f31835023e49e84dd2d (diff) | |
download | dimension-efd3c1c2b42ffda0c8f7e5cd9b03fba07eead1ea.tar.xz |
Handle sRGB gamma correctly.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r-- | libdimension/dimension/color.h | 4 | ||||
-rw-r--r-- | libdimension/dimension/pigments.h | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/libdimension/dimension/color.h b/libdimension/dimension/color.h index 98d1530..d4e0402 100644 --- a/libdimension/dimension/color.h +++ b/libdimension/dimension/color.h @@ -77,6 +77,10 @@ dmnsn_color_is_black(dmnsn_color color) /* Perceptual color manipulation */ +/** Convert from sRGB space. */ +dmnsn_color dmnsn_color_from_sRGB(dmnsn_color color); +/** Convert to sRGB space. */ +dmnsn_color dmnsn_color_to_sRGB(dmnsn_color color); /** Greyscale color intensity. */ double dmnsn_color_intensity(dmnsn_color color); /** Add two colors together. */ diff --git a/libdimension/dimension/pigments.h b/libdimension/dimension/pigments.h index 26b75f8..e62963e 100644 --- a/libdimension/dimension/pigments.h +++ b/libdimension/dimension/pigments.h @@ -45,13 +45,22 @@ dmnsn_pigment *dmnsn_new_canvas_pigment(dmnsn_canvas *canvas); dmnsn_map *dmnsn_new_color_map(void); /** + * pigment_map flags. + */ +typedef enum dmnsn_pigment_map_flags { + DMNSN_PIGMENT_MAP_REGULAR, /**< Calculate linear color gradients. */ + DMNSN_PIGMENT_MAP_SRGB /**< Calculate sRGB color gradients. */ +} dmnsn_pigment_map_flags; + +/** * A color-mapped pigment. * @param[in,out] pattern The pattern of the pigment. * @param[in,out] map The color map to apply to the pattern. * @return A pigment mapping the pattern to color values. */ dmnsn_pigment *dmnsn_new_color_map_pigment(dmnsn_pattern *pattern, - dmnsn_map *map); + dmnsn_map *map, + dmnsn_pigment_map_flags flags); /** * Construct a pigment map. @@ -66,4 +75,5 @@ dmnsn_map *dmnsn_new_pigment_map(void); * @return A pigment mapping the pattern to other pigments. */ dmnsn_pigment *dmnsn_new_pigment_map_pigment(dmnsn_pattern *pattern, - dmnsn_map *map); + dmnsn_map *map, + dmnsn_pigment_map_flags flags); |