C
C#4w 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
Ktoto4w ago
can u change image pixel by pixel?
Core
CoreOP4w ago
yes I can, bu I thought there is a cleaner way to do it
Ktoto
Ktoto4w 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
CoreOP3w 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