From bfbe9e43e108f6816c17b9b7764b75284ac78313 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 14 Dec 2011 19:27:22 -0500 Subject: Re-think colors. Color is a property of light, and thus doesn't include information about transparency. But canvas pixels and object pigments represent a color and a degree of transparency. The new type dmnsn_tcolor/ TColor encapsulates that information. Also, fix the transparent shadow implementation. --- libdimension/dimension/canvas.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'libdimension/dimension/canvas.h') diff --git a/libdimension/dimension/canvas.h b/libdimension/dimension/canvas.h index 48a64c1..ba06b8c 100644 --- a/libdimension/dimension/canvas.h +++ b/libdimension/dimension/canvas.h @@ -26,7 +26,7 @@ #include /** A canvas, or image. */ -typedef struct { +typedef struct dmnsn_canvas { size_t width; /**< Canvas width. */ size_t height; /**< Canvas height. */ @@ -38,7 +38,7 @@ typedef struct { * Stored in first-quadrant representation (origin is bottom-left). The pixel * at (a,b) is accessible as pixels[b*width + a]. */ - dmnsn_color *pixels; + dmnsn_tcolor *pixels; dmnsn_refcount refcount; /**< @internal Reference count. */ } dmnsn_canvas; @@ -94,9 +94,9 @@ void dmnsn_canvas_optimize(dmnsn_canvas *canvas, * @param[in] canvas The canvas to access. * @param[in] x The x coordinate. * @param[in] y The y coordinate. - * @return The color of the canvas at (\p x, \p y). + * @return The color of the pixel at (\p x, \p y). */ -DMNSN_INLINE dmnsn_color +DMNSN_INLINE dmnsn_tcolor dmnsn_canvas_get_pixel(const dmnsn_canvas *canvas, size_t x, size_t y) { dmnsn_assert(x < canvas->width && y < canvas->height, @@ -105,18 +105,18 @@ dmnsn_canvas_get_pixel(const dmnsn_canvas *canvas, size_t x, size_t y) } /** - * Set the color of a pixel. + * Set the value of a pixel. * @param[in,out] canvas The canvas to modify. * @param[in] x The x coordinate of the pixel. * @param[in] y The y coordinate of the pixel. - * @param[in] color The color to set the pixel at (\p x, \p y) to. + * @param[in] tcolor The value to set the pixel at (\p x, \p y) to. */ void dmnsn_canvas_set_pixel(dmnsn_canvas *canvas, size_t x, size_t y, - dmnsn_color color); + dmnsn_tcolor tcolor); /** * Clear a canvas uniformly with a given color. * @param[in,out] canvas The canvas to erase. - * @param[in] color The color to paint it with. + * @param[in] tcolor The color to paint it with. */ -void dmnsn_canvas_clear(dmnsn_canvas *canvas, dmnsn_color color); +void dmnsn_canvas_clear(dmnsn_canvas *canvas, dmnsn_tcolor tcolor); -- cgit v1.2.3