SkiaSharp
SkiaSharp copied to clipboard
[BUG] SKBitmap pixels are premultiplied, even if specified un-premultiplied at constructor.
SKBitmap pixels are premultiplied, even if specified un-premultiplied at constructor.
SKBitmap bmp = new SKBitmap(16,16, SKColorType.Rgba8888, SKAlphaType.Unpremul);
bmp.SetPixel(0, 0, new SKColor(red: 255, green:255,blue:255,alpha:100));
byte[] bytes = bmp.Bytes;
Assert.IsTrue(bytes[0] == 255); //Blue. Expected 255, result 100
Assert.IsTrue(bytes[1] == 255); //Green. Expected 255, result 100
Assert.IsTrue(bytes[2] == 255); //Red. Expected 255, result 100
Assert.IsTrue(bytes[3] == 100); //Alpha. Expected 100, result 100
Note : Chaning the SKAlphaType value to Opaque or Premultiplied does not change the result.
- Version with issue: 1.60.3
- Last known good version: N/A
- IDE: Visual Studio
- Platform Target Frameworks: Full Framework / Windows 10
VS bug #782039
Thanks for reporting this, I will investigate.
This issue still happens five years later on SkiaSharp 2.88.8
This appears to be fixed in SkiaSharp 3.x releases. let me know if this is not working for you.
It does appear to be fixed.