Skip to content

Commit 9c91ef3

Browse files
committed
Fix Normal() not factoring in opacity
The alpha calculation in Normal() did not factor in opacity, causing layer and cel opacity to render incorrectly against transparent layers.
1 parent 7facef9 commit 9c91ef3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

source/AsepriteDotNet/Aseprite/AsepriteColorUtilities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ private static Rgba32 Normal(Rgba32 backdrop, Rgba32 source, int opacity)
245245

246246
opacity = Calc.MultiplyUnsigned8Bit(source.A, opacity);
247247

248-
int a = source.A + backdrop.A - Calc.MultiplyUnsigned8Bit(backdrop.A, source.A);
248+
int a = backdrop.A + opacity - Calc.MultiplyUnsigned8Bit(backdrop.A, opacity);
249249
int r = backdrop.R + (source.R - backdrop.R) * opacity / a;
250250
int g = backdrop.G + (source.G - backdrop.G) * opacity / a;
251251
int b = backdrop.B + (source.B - backdrop.B) * opacity / a;

0 commit comments

Comments
 (0)