diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-05-20 18:59:18 -0600 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-05-20 18:59:18 -0600 |
commit | 18b89c6edc29a009b1419e6d34bc3eef2dd911b9 (patch) | |
tree | 02f36651220fbd0821c94d6c13848bd9beb59098 /libdimension/png.c | |
parent | 250b980002419746fc099c7633b9600a15afb1c6 (diff) | |
download | dimension-18b89c6edc29a009b1419e6d34bc3eef2dd911b9.tar.xz |
Switch to Blender model of filtered transparency.
Diffstat (limited to 'libdimension/png.c')
-rw-r--r-- | libdimension/png.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libdimension/png.c b/libdimension/png.c index d80ecc0..3920e7e 100644 --- a/libdimension/png.c +++ b/libdimension/png.c @@ -92,13 +92,12 @@ dmnsn_png_optimizer_fn(const dmnsn_canvas *canvas, pixel[2] = color.B*UINT16_MAX; } - double alpha = dmnsn_color_intensity(color)*color.filter + color.trans; - if (alpha <= 0.0) { + if (color.trans <= 0.0) { pixel[3] = 0; - } else if (alpha >= 1.0) { + } else if (color.trans >= 1.0) { pixel[3] = UINT16_MAX; } else { - pixel[3] = alpha*UINT16_MAX; + pixel[3] = color.trans*UINT16_MAX; } } @@ -299,13 +298,12 @@ dmnsn_png_write_canvas_thread(void *ptr) row[4*x + 2] = color.B*UINT16_MAX; } - double alpha = color.filter + color.trans; - if (alpha <= 0.0) { + if (color.trans <= 0.0) { row[4*x + 3] = 0; - } else if (alpha >= 1.0) { + } else if (color.trans >= 1.0) { row[4*x + 3] = UINT16_MAX; } else { - row[4*x + 3] = alpha*UINT16_MAX; + row[4*x + 3] = color.trans*UINT16_MAX; } } |