summaryrefslogtreecommitdiff
path: root/src/fl_images_core.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-09-03 13:14:25 +0000
committerManolo Gouy <Manolo>2017-09-03 13:14:25 +0000
commit1a28d85dc3f8f062401002bebc8e8a59805cce9b (patch)
tree4fd0412732046d526e44476ea22eab343c36673c /src/fl_images_core.cxx
parentda31ff4569a252e314ab91b3ea9cc11aafec2a24 (diff)
Add new Fl_SVG_Image class to support scalable vector graphics images using the (modified) nanosvg software.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12413 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_images_core.cxx')
-rw-r--r--src/fl_images_core.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx
index 6982b1066..5af696764 100644
--- a/src/fl_images_core.cxx
+++ b/src/fl_images_core.cxx
@@ -31,6 +31,7 @@
#include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_PNM_Image.H>
+#include <FL/Fl_SVG_Image.H>
#include <stdio.h>
#include <stdlib.h>
#include "flstring.h"
@@ -63,7 +64,7 @@ void fl_register_images() {
Fl_Image * // O - Image, if found
fl_check_images(const char *name, // I - Filename
uchar *header, // I - Header data from file
- int) { // I - Amount of data (not used)
+ int headerlen) { // I - Amount of data
if (memcmp(header, "GIF87a", 6) == 0 ||
memcmp(header, "GIF89a", 6) == 0) // GIF file
return new Fl_GIF_Image(name);
@@ -88,6 +89,12 @@ fl_check_images(const char *name, // I - Filename
return new Fl_JPEG_Image(name);
#endif // HAVE_LIBJPEG
+#ifdef FLTK_USE_NANOSVG
+ if ( (headerlen > 5 && memcmp(header, "<?xml", 5) == 0) ||
+ memcmp(header, "<svg", 4) == 0)
+ return new Fl_SVG_Image(name);
+#endif // FLTK_USE_NANOSVG
+
return 0;
}