-
Notifications
You must be signed in to change notification settings - Fork 129
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
Support using SVG as mask #153
Comments
Hi! This repo isn’t supported, please switch to https://github.com/HumbleUI/Skija/ Re: your question, I believe we have draw picture that supports Paint argument, here https://github.com/HumbleUI/Skija/blob/db338c72d80417ce4c93be23c2a4e1398642a590/shared/java/Canvas.java#L521 I’m not really sure how you’ll get SVG into a Picture though, neither how much from that Paint is used in this method. Comment says “@param paint SkPaint to apply transparency, filtering, and so on;” (https://github.com/google/skia/blob/c983b97d03a8824113692ad9c5a483c9c03719df/include/core/SkCanvas.h#L1922), so I guess you’ll have to experiment. |
I was mainly just copying from the StackOverflow answer for SkiaSharp, I have no clue how Skija's internals work and as such I don't know if it's feasible to even get an image from the SVG in the first place, I just assumed it would have an overload for SVGs. The solution proposed in the linked StackOverflow answer would use a Lighting color filter to apply a color on the non-transparent parts of the SVGs (I think?)
Does Compose/Skiko also pull from the HumbleUI fork, or does it remain linked against this repository? |
I am not sure, better ask them. I don’t think they pull from HumbleUI, but I also not sure if they pull from here |
btw if you are going to dig into this, notice that picture is very different in Skia terms from Image, and it’s also different from Bitmap. SVG is neither, it’s its own thing that can draw itself on a canvas, I think. I suggest going to the source to learn how SkiaSharp works under the hood and then you’ll probably be able to apply it to Skija. Skija is a very thin translation layer on top of Skia, so their APIs are very similar |
I'd like to fill an SVG with a given color through code, and while editing the SVG isn't supported on most platforms, other methods that seem to be present in other ports seem to not exist in skija.
Ideas for solutions:
canvas.drawPicture(svg, paint)
canvas.drawPolygon(svg, paint)
canvas.clipSVG(svg)
In case these are bad ways to approach the issue, an alternative would also be very welcome :)
The text was updated successfully, but these errors were encountered: