You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When drawing on an empty canvas with a half transparent color, then the resulting color is not identically to the paint anymore.
Example:
background cleared with rgba(0,0,0,0)
paint with color rgba(0,0,255,128), blue with 50% alpha, SKBlendMode.SrcOver
result is rgba(0,0,128,128), so the blue was changed from 255 to 128
Code
varsize=32;varbuffer=newbyte[size*size*4];varpinnedbuffer=GCHandle.Alloc(buffer,GCHandleType.Pinned);varpointer=pinnedbuffer.AddrOfPinnedObject();varimageinfo=newSKImageInfo(size,size,SKColorType.Rgba8888,SKAlphaType.Premul);using(varsurface=SKSurface.Create(imageinfo,pointer)){varblendmodes=Enum.GetValues(typeof(SKBlendMode));varcolor=newSKColor(0,0,255,128);foreach(varblendmodeinblendmodes){surface.Canvas.Clear(newSKColor(0,0,0,0));varpaint=newSKPaint{Style=SKPaintStyle.Fill,Color=color,BlendMode=(SKBlendMode)blendmode};surface.Canvas.DrawRect(0,0,size,size,paint);// check first pixelvarr=buffer[0];varg=buffer[1];varb=buffer[2];vara=buffer[3];//Debug.WriteLine(string.Format("alpha={0} blue={1} mode={2}", a, b, blendmode.ToString()));if(a==color.Alpha&&b==color.Blue){// ok}}}
Expected Behavior
Drawing with source rgba(0,0,255,128) with SrcOver on an emtpy canvas destination rgba(0,0,0,0) should result in unchanged color.
Actual Behavior
Its not, result is rgba(0,0,128,128) instead of rgba(0,0,255,128).
I actually tried all SKBlendmodes, but none of them is producing the expected behaviour.
Version of SkiaSharp
2.88.3 (Current)
Last Known Good Version of SkiaSharp
Other (Please indicate in the description)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
Windows
Devices
No response
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Description
When drawing on an empty canvas with a half transparent color, then the resulting color is not identically to the paint anymore.
Example:
Code
Expected Behavior
Drawing with source rgba(0,0,255,128) with SrcOver on an emtpy canvas destination rgba(0,0,0,0) should result in unchanged color.
Actual Behavior
Its not, result is rgba(0,0,128,128) instead of rgba(0,0,255,128).
I actually tried all SKBlendmodes, but none of them is producing the expected behaviour.
Version of SkiaSharp
2.88.3 (Current)
Last Known Good Version of SkiaSharp
Other (Please indicate in the description)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Windows
Platform / Operating System Version
Windows
Devices
No response
Relevant Screenshots
No response
Relevant Log Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: