Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] SKBlendMode.Multiply not working correctly #3017

Open
1 task done
martinrhan opened this issue Sep 25, 2024 · 0 comments
Open
1 task done

[BUG] SKBlendMode.Multiply not working correctly #3017

martinrhan opened this issue Sep 25, 2024 · 0 comments
Labels

Comments

@martinrhan
Copy link

Description

The multiply blend mode in computer graphics should convert each part of RGBA to float ranging at [0,1], and multiply them. That means if one of the color is 0, then the outcome should be zero no matter what the another one is. However, when I multiply color 0 and color 0xFF000000 (by the way, the uint representation of color takes first byte as alpha, this is inconsistent with the convention). the outcome is not zero.

Code

Draw the following paint

var shader = SKShader.CreateCompose(SKShader.CreateColor(0), SKShader.CreateColor(new(0,0,0,255)), SKBlendMode.Multiply);
var paint =  new SKPaint() { Shader = shader };

Expected Behavior

The paint should draw nothing, as the composed color is 0 after multiplication.

Actual Behavior

It draws zero RGB with 255 alpha.

Version of SkiaSharp

3.x (Alpha)

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 11 Home 23H2

Devices

Nitro AN515-58

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant