mirror of
https://github.com/minetest/minetestmapper.git
synced 2024-11-21 23:13:53 +01:00
Fix color2int, int2color alpha handling (libgd alpha is 0-127)
This commit is contained in:
parent
97c5dc0a83
commit
f7b0d5c532
@ -19,7 +19,7 @@
|
||||
|
||||
static inline int color2int(Color c)
|
||||
{
|
||||
u8 a = 255 - c.a;
|
||||
u8 a = (255 - c.a) * gdAlphaMax / 255;
|
||||
return (a << 24) | (c.r << 16) | (c.g << 8) | c.b;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ static inline Color int2color(int c)
|
||||
c2.g = (c >> 8) & 0xff;
|
||||
c2.r = (c >> 16) & 0xff;
|
||||
a = (c >> 24) & 0xff;
|
||||
c2.a = 255 - a;
|
||||
c2.a = 255 - (a*255 / gdAlphaMax);
|
||||
return c2;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user