-
Notifications
You must be signed in to change notification settings - Fork 14
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
Any way to import/compose SVG files? #41
Comments
Den ons. 23. nov. 2022 kl. 15.18 skrev Nicholas Clare <
***@***.***>:
I was wondering if there was a way to create objects from existing SVG
images, or any existing converter that would allow me to create new
functions from SVG files?
For reference, I'm trying to see if MetaPict can be useful for creating
system architecture diagrams, particularly using the AWS Architecture
Icons, which they provide in SVG format.
I've only just started looking at metapict and racket, and its been many
years since I wrote any lisp code at all, so while I'm willing to dive in
and try make this work myself, I wanted to check if there were any existing
ways before I wasted my time
This is a very good question. After looking into it, I must admit, the
story isn't particularly good at the moment.
Realistically I think the best bet is to turn the SVGs into PNGs. A PNG can
then without any problems
be used as a pict.
For the diagrams I recommend using "nodes" in Metapict:
https://youtu.be/7Kf8Kk8NPFw?t=577
The various node functions are listed here:
https://github.com/soegaard/metapict/blob/master/metapict/node.rkt#L8
Back to SVGs: As far as I know there is no SVG drawing library using Racket.
Metapict works on top of `pict` which is a way of representing drawings in
Racket.
The `pict` library is built using the graphics library Cairo (implemented
in C).
Years ago the solution was to use the Racket library `rsvg` which included
a way to turn an svg file into a pict. The pict could then be used with,
say Metapict.
It might be possible to get `rsvg` running again. It consists of bindings
for `librsvg` which
was a C library that could render SVGs using Cairo. Time has passed and now
`librsvg`
is implemented in Rust - but I believe there is still a C interface.
Rendering SVGs using Racket would be a good thing - so I might look at the
problem
later. I can't promise an immediate solution though.
But ... maybe I have missed a way to render SVGs. Try asking the Discourse
on
how to draw SVGs with Racket.
/Jens Axel
|
I am happy to report, that Turns out the C api has changed in years, so installing a new version of I installed C library And the Racket library A small test with random svg file worked fine:
|
Thanks so much for the quick response. I'll definitely try this out and let you know how it goes. Ideally what I want to do is have a library of high-level functions that draw the AWS components according to their style guide, but being able to draw the SVG files they give is a huge first step. |
I was wondering if there was a way to create objects from existing SVG images, or any existing converter that would allow me to create new functions from SVG files?
For reference, I'm trying to see if MetaPict can be useful for creating system architecture diagrams, particularly using the AWS Architecture Icons, which they provide in SVG format.
I've only just started looking at metapict and racket, and its been many years since I wrote any lisp code at all, so while I'm willing to dive in and try make this work myself, I wanted to check if there were any existing ways before I wasted my time
The text was updated successfully, but these errors were encountered: