From 5ac641382d38e2bfb6b825aa0f56b9be7c5fedc2 Mon Sep 17 00:00:00 2001 From: Erik Reckase Date: Wed, 12 Jan 2011 20:52:59 +0000 Subject: roundoff error was introducing some strangeness in smoothly interpolated genome palettes - now ensure that all 1.0 alpha channels -> 1.0 alpha in output git-svn-id: https://flam3.googlecode.com/svn/trunk@156 77852712-ef1d-11de-8684-7d64432d61a3 --- src/interpolation.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/interpolation.c b/src/interpolation.c index c4e680b..b23e687 100644 --- a/src/interpolation.c +++ b/src/interpolation.c @@ -367,6 +367,8 @@ void flam3_interpolate_n(flam3_genome *result, int ncp, for (i = 0; i < 256; i++) { double t[3], s[4]; + int alpha1 = 1; + s[0] = s[1] = s[2] = s[3] = s[4] = 0.0; for (k = 0; k < ncp; k++) { @@ -375,9 +377,14 @@ void flam3_interpolate_n(flam3_genome *result, int ncp, s[j] += c[k] * t[j]; s[3] += c[k] * cpi[k].palette[i].color[3]; + if (cpi[k].palette[i].color[3] != 1.0) + alpha1 = 0; s[4] += c[k] * cpi[k].palette[i].index; } + + if (alpha1 == 1) + s[3] = 1.0; hsv2rgb(s, result->palette[i].color); result->palette[i].color[3] = s[3]; -- cgit v1.2.3