Skip to content

Ignore transparent pixels for non-separable blend modes? #2311

Answered by Dresel
Dresel asked this question in Q&A
Discussion options

You must be logged in to vote

I was looking for a SKImage.ApplyImageFilter solution, this is possible by wrapping the SKImageFilter:

public static SKImage Colorize(SKImage image, SKColor color)
{
    var filter = SKImageFilter.CreateBlendMode(SKBlendMode.DstIn,
        SKImageFilter.CreateColorFilter(SKColorFilter.CreateBlendMode(color, SKBlendMode.Color))
    );
    return image.ApplyImageFilter(filter, image.Info.Rect, image.Info.Rect, out _, out SKPointI _);
}

See StackOverflow.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Dresel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant