summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErik Reckase <e.reckase@gmail.com>2011-01-12 20:52:59 +0000
committerScott Draves <spot@draves.org>2015-02-15 12:20:15 -0500
commit5ac641382d38e2bfb6b825aa0f56b9be7c5fedc2 (patch)
tree28e3d5e9678f47251dbaec149a8bb2428954072a /src
parentce2bbf871f3ebaea965bb3567105527dbdf640ea (diff)
downloadpucket-5ac641382d38e2bfb6b825aa0f56b9be7c5fedc2.tar.gz
pucket-5ac641382d38e2bfb6b825aa0f56b9be7c5fedc2.tar.bz2
pucket-5ac641382d38e2bfb6b825aa0f56b9be7c5fedc2.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/interpolation.c7
1 files changed, 7 insertions, 0 deletions
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];