I’m working on a small server where I want to render an image as PNG and serve it as a mime png.
I used cairo and vg and got pretty far drawing dots, squares and positioning them, even fonts, but now I wanted to “load” an image into the png.
I thought I could have a buffer, and render any image and move them accordingly as any other
Vg.I, at this point I started reading the documentation and didn’t get any far.
So, after opening this issue Multiple Images · Issue #30 · dbuenzli/vg · GitHub I opening this post here to fix my head around this.
If I understand correctly: If I want to read the data of a filename I should use
Cairo.PNG.create and this gives me back a surface, then create another surface with empty data, create 2 contexts and somehow merge the renderables? But then, I have no way to position the image with Vg.I and I need to do it with
Cairo.move_to. I suspect that isn’t the best way to load an image.
PS: Apologies if the terminology is off, I feel like the definitions require a good knowledge of Cairo already, which I don’t have.
Thanks in advance!