Coder Social home page Coder Social logo

Support using SVG as mask about skija HOT 4 OPEN

Martmists-GH avatar Martmists-GH commented on June 1, 2024
Support using SVG as mask

from skija.

Comments (4)

tonsky avatar tonsky commented on June 1, 2024

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.

from skija.

Martmists-GH avatar Martmists-GH commented on June 1, 2024

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?)

This repo isn’t supported, please switch to https://github.com/HumbleUI/Skija/

Does Compose/Skiko also pull from the HumbleUI fork, or does it remain linked against this repository?

from skija.

tonsky avatar tonsky commented on June 1, 2024

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

from skija.

tonsky avatar tonsky commented on June 1, 2024

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

from skija.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.