FLTK logo

RE: [fltk.general] Read in SVG and render using cairo - [General Use]

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

RE: Read in SVG and render using cairo - [General Use] "'MacArthur, Ian (Leonardo, UK)' via fltk.general" Nov 03, 2020  
 
> Hi. I know I can read in SVG image using FL_SVG_Image(). However,
> this uses rasterize_image(); to convert the SVG to bitmap.
> Since FLTK supports Cairo, is there a way to read in the paths and
> map them to a cairo context instead ?
> So the SVG gets mapped to Cairo commands not to a bitmap.

Not using fltk. You may be able to do this using other libs though, but...

Note that it is possibly overstating things to say that fltk "supports" Cairo, as there is no fltk back-end that actually renders via Cairo.
It is perhaps better to say that fltk can work with Cairo, I suppose.

Fltk really only deals in pixelmaps internally, so where we use SVG, we tend to rasterize the result for display, as you note.

There are other libs that can handle SVG files and work with Cairo, so you might be able to use one of those to get the SVG loaded into Cairo in a suitable (presumably vector) form.

However, the only lib I actually have any idea about that reads in SVG files and can render them with Cairo is librsvg which, AFAIK, also rasterizes the SVG file for display, so presumably does not retain the vector form.
I may be wrong about that!
And in any case there's a fair chance it (librsvg) does a more thorough job than our rasterizer, which we picked because it was fast and light, not because it was the very best SVG rasterizer...

But don’t take my word for it, as I don’t really know SVG and Cairo, beyond the bits I have done to solve the specific issues I had!


Leonardo MW Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

-- 
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/17691672a4504060ab368cd0b66d3181%40leonardocompany.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.