|
|
|
@ -80,6 +80,7 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
byte scaledLuminanceTrans = (byte)(luminanceTrans * scaleFactor); |
|
|
|
Rgba32 rgba32 = default; |
|
|
|
for (int x = 0; x < header.Width; x++) |
|
|
|
{ |
|
|
|
@ -87,7 +88,7 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
|
rgba32.R = luminance; |
|
|
|
rgba32.G = luminance; |
|
|
|
rgba32.B = luminance; |
|
|
|
rgba32.A = luminance.Equals(luminanceTrans) ? byte.MinValue : byte.MaxValue; |
|
|
|
rgba32.A = luminance.Equals(scaledLuminanceTrans) ? byte.MinValue : byte.MaxValue; |
|
|
|
|
|
|
|
pixel.PackFromRgba32(rgba32); |
|
|
|
Unsafe.Add(ref rowSpanRef, x) = pixel; |
|
|
|
@ -163,6 +164,7 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
byte scaledLuminanceTrans = (byte)(luminanceTrans * scaleFactor); |
|
|
|
Rgba32 rgba32 = default; |
|
|
|
for (int x = pixelOffset; x < header.Width; x += increment) |
|
|
|
{ |
|
|
|
@ -170,7 +172,7 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
|
rgba32.R = luminance; |
|
|
|
rgba32.G = luminance; |
|
|
|
rgba32.B = luminance; |
|
|
|
rgba32.A = luminance.Equals(luminanceTrans) ? byte.MinValue : byte.MaxValue; |
|
|
|
rgba32.A = luminance.Equals(scaledLuminanceTrans) ? byte.MinValue : byte.MaxValue; |
|
|
|
|
|
|
|
pixel.PackFromRgba32(rgba32); |
|
|
|
Unsafe.Add(ref rowSpanRef, x) = pixel; |
|
|
|
|