@manolo,I did not ask 'Howto show an SVG image'. I did ask 'What is wrong with a copped SVG image'.I use an Fl_Overlay_Window which allows me to crop parts of an image. When I use PNG, TIFF,etc. images, cropping is OK. But cropping of an SVG image returns out to be bad. An I do notknow, why.
> There is room in the world for both.
> There is no conflict there.
You did not touch on the quality of rendering issue. Obviously, the quality of rendering cairo is able to achieve is much greater than that of NanoSVG.
The vector rendering in FLTK's examples/howto-simple-svg
seems pretty good to me.
The edges are beautifully antialiased, the font curves are
smooth, and the entire rendering
can be translated/rotated/scaled nicely.
I dunno, nanosvg seems perfect for what FLTK needs to render
higher end widgets;
antialiased lines across platforms, gradients, and curved
vectors across all platforms,
in addition to other features.
When FLTK starts providing higher end widgets that make use of
nanosvg for rendering
on the back end, it would improve the look of interfaces
greatly. Some nicer looking
switches/buttons/dials/meters/numeric displays would all be
possible, and a great improvement.
Anyone wanting the full features of an SVG image library can
certainly link in cairo to
access such functionality. But not everyone using FLTK needs
such high end rendering.
NanoSVG was/is meant to be a toy implementation, hence incorporating it into FLTK was wrong.
Disagree most strongly.
The minimal implementation of nanosvg is a perfect fit for
what FLTK needs
without all the extra overhead of a full SVG/cairo
implementation.
If there's an SVG library that better supports SVG without
requiring external libs,
we might switch to it while keeping our API the same.
NanoSVG isn't wrong, it's a very good start.
On 1/2/21 12:19 PM, janezz55 wrote:
To each his own. Browsing through NanoSVG source code should convince you that the author was just toying/experimenting.
OK, let's say nanosvg in FLTK is a problem that needs to be
solved.
What SVG library specifically would be the right solution for
FLTK?
The developers are open to suggestions, and certainly
nanosvg's
addition to FLTK started out as a suggestion and was voted in
because
it met all of FLTK's core criteria: small code footprint, no
external
library dependencies, seemed well embraced by those who've
used
it in practice, and worked efficiently for what it does
support, and
provides noticeable improment to the FLTK library in the form
of
providing antialiased vector rendering across all platforms.
We could always support a different SVG library when the time
comes
via FLTK's configure options, e.g. --enable-svg-xyz
So, I would modernise the fltk display driver API taking, say, OpenVG, cairo or even QPainter as inspiration. Writing a SVG renderer would then be trivial, using practically any available SVG parser.