summaryrefslogtreecommitdiffstats
path: root/libdimension/canvas_pigment.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-12-14 19:27:22 -0500
committerTavian Barnes <tavianator@gmail.com>2011-12-14 19:52:36 -0500
commitbfbe9e43e108f6816c17b9b7764b75284ac78313 (patch)
tree189f85eeec18a76ccb626e45455fa7e45406db7c /libdimension/canvas_pigment.c
parent7db5342a36341b061a8785a3b349cf0fcad69ebf (diff)
downloaddimension-bfbe9e43e108f6816c17b9b7764b75284ac78313.tar.xz
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.
Diffstat (limited to 'libdimension/canvas_pigment.c')
-rw-r--r--libdimension/canvas_pigment.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libdimension/canvas_pigment.c b/libdimension/canvas_pigment.c
index 564ce00..6847b6c 100644
--- a/libdimension/canvas_pigment.c
+++ b/libdimension/canvas_pigment.c
@@ -26,16 +26,14 @@
#include "dimension.h"
/** Canvas pigment color callback. */
-static dmnsn_color
+static dmnsn_tcolor
dmnsn_canvas_pigment_fn(const dmnsn_pigment *pigment, dmnsn_vector v)
{
dmnsn_canvas *canvas = pigment->ptr;
size_t x = llround((fmod(v.x, 1.0) + 1.0)*(canvas->width - 1));
size_t y = llround((fmod(v.y, 1.0) + 1.0)*(canvas->height - 1));
- dmnsn_color c = dmnsn_canvas_get_pixel(canvas,
- x%canvas->width, y%canvas->height);
- return c;
+ return dmnsn_canvas_get_pixel(canvas, x%canvas->width, y%canvas->height);
}
/** Canvas pigment destructor. */