C
C#2w ago
Core

✅ 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
No description
4 Replies
Ktoto
Ktoto2w ago
can u change image pixel by pixel?
Core
CoreOP2w ago
yes I can, bu I thought there is a cleaner way to do it
Ktoto
Ktoto2w ago
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
Core
CoreOP2w ago
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....
Want results from more Discord servers?
Add your server