✅ SkiaSharp apply gradient on the whole canvas except to one color
Hello,
I would like to apply a gradient texture on a canvas, after the drawing is complete, and not to draw individual shapes with gradient color, that would have a different effect.
Is there a way to apply gradient to the whole canvas except to a certain color? In my case I would like the canvas background to remain white, but the black areas to have a gradient effect
4 Replies
can u change image pixel by pixel?
yes I can, bu I thought there is a cleaner way to do it
if u won't find it, just take pixel, compare it with ur colors, if != take pixel position divide by image size, u'll get a numbers from 1 to zero & multiplicate gradient color1 by it & color2 by abs of result of divide-- and sum them
Gosh I found a solution and it was too easy.....
All I needed to do is to create a shader and use it when drawing....