Ecere Software
/
sdk
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d02b0b8
)
ecere/gfx/Surface: Fixed PaletteGradient() ignoring alpha
author
Jerome St-Louis
<jerome@ecere.com>
Sat, 22 Oct 2016 15:00:48 +0000
(11:00 -0400)
committer
Jerome St-Louis
<jerome@ecere.com>
Sat, 22 Oct 2016 15:13:33 +0000
(11:13 -0400)
ecere/src/gfx/Surface.ec
patch
|
blob
|
history
diff --git
a/ecere/src/gfx/Surface.ec
b/ecere/src/gfx/Surface.ec
index
ca04ea7
..
bc13065
100644
(file)
--- a/
ecere/src/gfx/Surface.ec
+++ b/
ecere/src/gfx/Surface.ec
@@
-43,21
+43,25
@@
public void PaletteGradient(ColorAlpha * palette, int numColors, ColorKey * keys
{
float scale = ease((percent - key->percent) / (nextKey->percent - key->percent),
smoothness, smoothness);
{
float scale = ease((percent - key->percent) / (nextKey->percent - key->percent),
smoothness, smoothness);
+ int ca = key->color.a;
int cr = key->color.color.r;
int cg = key->color.color.g;
int cb = key->color.color.b;
int cr = key->color.color.r;
int cg = key->color.color.g;
int cb = key->color.color.b;
+ int na = nextKey->color.color.r;
int nr = nextKey->color.color.r;
int ng = nextKey->color.color.g;
int nb = nextKey->color.color.b;
int nr = nextKey->color.color.r;
int ng = nextKey->color.color.g;
int nb = nextKey->color.color.b;
+ int a = (int)(ca + (na - ca) * scale);
int r = (int)(cr + (nr - cr) * scale);
int g = (int)(cg + (ng - cg) * scale);
int b = (int)(cb + (nb - cb) * scale);
int r = (int)(cr + (nr - cr) * scale);
int g = (int)(cg + (ng - cg) * scale);
int b = (int)(cb + (nb - cb) * scale);
+ a = Max(Min(r, 255),0);
r = Max(Min(r, 255),0);
g = Max(Min(g, 255),0);
b = Max(Min(b, 255),0);
r = Max(Min(r, 255),0);
g = Max(Min(g, 255),0);
b = Max(Min(b, 255),0);
- newColor = Color
{ (byte)r, (byte)g, (byte)b
};
+ newColor = Color
Alpha { (byte)a, { (byte)r, (byte)g, (byte)b }
};
}
else if(key)
newColor = key ? key->color : 0;
}
else if(key)
newColor = key ? key->color : 0;