diff options
Diffstat (limited to 'libdimension')
-rw-r--r-- | libdimension/dimension/color.h | 4 | ||||
-rw-r--r-- | libdimension/dimension/tcolor.h | 6 | ||||
-rw-r--r-- | libdimension/gl.c | 2 | ||||
-rw-r--r-- | libdimension/png.c | 2 | ||||
-rw-r--r-- | libdimension/rgba.c | 4 |
5 files changed, 9 insertions, 9 deletions
diff --git a/libdimension/dimension/color.h b/libdimension/dimension/color.h index afc4a5c..1b21d94 100644 --- a/libdimension/dimension/color.h +++ b/libdimension/dimension/color.h @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> * + * Copyright (C) 2009-2014 Tavian Barnes <tavianator@tavianator.com> * * * * This file is part of The Dimension Library. * * * @@ -156,7 +156,7 @@ dmnsn_color_illuminate(dmnsn_color light, dmnsn_color color) /** Saturate the color components to [0.0, 1.0]. */ DMNSN_INLINE dmnsn_color -dmnsn_color_saturate(dmnsn_color color) +dmnsn_color_clamp(dmnsn_color color) { color.R = dmnsn_min(dmnsn_max(color.R, 0.0), 1.0); color.G = dmnsn_min(dmnsn_max(color.G, 0.0), 1.0); diff --git a/libdimension/dimension/tcolor.h b/libdimension/dimension/tcolor.h index 4432dd1..f85fcd6 100644 --- a/libdimension/dimension/tcolor.h +++ b/libdimension/dimension/tcolor.h @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2011 Tavian Barnes <tavianator@tavianator.com> * + * Copyright (C) 2009-2014 Tavian Barnes <tavianator@tavianator.com> * * * * This file is part of The Dimension Library. * * * @@ -91,9 +91,9 @@ dmnsn_tcolor_remove_filter(dmnsn_tcolor tcolor) /** Saturate the tcolor components to [0.0, 1.0]. */ DMNSN_INLINE dmnsn_tcolor -dmnsn_tcolor_saturate(dmnsn_tcolor tcolor) +dmnsn_tcolor_clamp(dmnsn_tcolor tcolor) { - tcolor.c = dmnsn_color_saturate(tcolor.c); + tcolor.c = dmnsn_color_clamp(tcolor.c); tcolor.T = dmnsn_min(dmnsn_max(tcolor.T, 0.0), 1.0); tcolor.F = dmnsn_min(dmnsn_max(tcolor.F, 0.0), 1.0); return tcolor; diff --git a/libdimension/gl.c b/libdimension/gl.c index dd707a9..77099d2 100644 --- a/libdimension/gl.c +++ b/libdimension/gl.c @@ -60,7 +60,7 @@ dmnsn_gl_write_canvas(const dmnsn_canvas *canvas) dmnsn_tcolor tcolor = dmnsn_canvas_get_pixel(canvas, x, y); tcolor = dmnsn_tcolor_remove_filter(tcolor); tcolor.c = dmnsn_color_to_sRGB(tcolor.c); - tcolor = dmnsn_tcolor_saturate(tcolor); + tcolor = dmnsn_tcolor_clamp(tcolor); pixel[0] = lround(tcolor.c.R*UINT8_MAX); pixel[1] = lround(tcolor.c.G*UINT8_MAX); diff --git a/libdimension/png.c b/libdimension/png.c index faca080..6b73738 100644 --- a/libdimension/png.c +++ b/libdimension/png.c @@ -198,7 +198,7 @@ dmnsn_png_write_canvas_thread(void *ptr) x, height - y - 1); tcolor = dmnsn_tcolor_remove_filter(tcolor); tcolor.c = dmnsn_color_to_sRGB(tcolor.c); - tcolor = dmnsn_tcolor_saturate(tcolor); + tcolor = dmnsn_tcolor_clamp(tcolor); row[4*x] = lround(tcolor.c.R*UINT16_MAX); row[4*x + 1] = lround(tcolor.c.G*UINT16_MAX); diff --git a/libdimension/rgba.c b/libdimension/rgba.c index 367927f..9889189 100644 --- a/libdimension/rgba.c +++ b/libdimension/rgba.c @@ -69,7 +69,7 @@ dmnsn_rgba8_optimizer_fn(dmnsn_canvas_optimizer *optimizer, const dmnsn_canvas * dmnsn_tcolor tcolor = dmnsn_canvas_get_pixel(canvas, x, y); tcolor = dmnsn_tcolor_remove_filter(tcolor); tcolor.c = dmnsn_color_to_sRGB(tcolor.c); - tcolor = dmnsn_tcolor_saturate(tcolor); + tcolor = dmnsn_tcolor_clamp(tcolor); pixel[0] = lround(tcolor.c.R*UINT8_MAX); pixel[1] = lround(tcolor.c.G*UINT8_MAX); @@ -86,7 +86,7 @@ dmnsn_rgba16_optimizer_fn(dmnsn_canvas_optimizer *optimizer, const dmnsn_canvas dmnsn_tcolor tcolor = dmnsn_canvas_get_pixel(canvas, x, y); tcolor = dmnsn_tcolor_remove_filter(tcolor); tcolor.c = dmnsn_color_to_sRGB(tcolor.c); - tcolor = dmnsn_tcolor_saturate(tcolor); + tcolor = dmnsn_tcolor_clamp(tcolor); pixel[0] = lround(tcolor.c.R*UINT16_MAX); pixel[1] = lround(tcolor.c.G*UINT16_MAX); |