Skip to content
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

Importing SVG #353

Open
vilim opened this issue May 14, 2019 · 1 comment
Open

Importing SVG #353

vilim opened this issue May 14, 2019 · 1 comment

Comments

@vilim
Copy link

vilim commented May 14, 2019

There doesn't seem to be a way to import external vector assets and use them with compose. Would it be necessary to write an e.g. SVG to Compose parser to implement this?

@lobingera
Copy link

a) there was recently a discussion about a SVG parser on discourse
b) not all SVG elements have counterparts in Compose right now, so some intermediate steps might be needed.
c) with Rsvg+Cairo you could get to a simple CairoScript notation that would be easier to parse (it's a few key words and numbers)

        using Rsvg
        using Cairo
        io = IOBuffer()
        cs = CairoScriptSurface(io,500.0,500.0)
        r = Rsvg.handle_new_from_file("../.julia/dev/Rsvg/data/star.svg")
        c = Cairo.CairoContext(cs)
        Rsvg.handle_render_cairo(c,r)
        seek(io,0)
        println(String(read(io)))

outputs

julia> include("rsvgscript.jl")
%!CairoScript
<< /content //COLOR_ALPHA /width 500 /height 500 >> surface context
n 168.894531 190.628906 m 113.09375 137.539062 l 61.144531 194.402344 l 79.21875 119.53125 l 4 102.972656 l 77.878906 81.195312 l 54.609375 7.773438 l 110.410156 60.863281 l 162.359375 4 l 144.28125 78.871094 l 219.5 95.429688 l 145.625 117.207031 l h 168.894531 190.628906 m
fill+
0.501961 0 0 rgb set-source
8 set-line-width
4 set-miter-limit
stroke+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants