From a9d17eca1a12f6dfb9cf7446f664c4c143b1d368 Mon Sep 17 00:00:00 2001 From: Greg Ercolano Date: Mon, 30 Oct 2017 03:43:25 +0000 Subject: Added a new example to demonstrate using Fl_SVG_Image. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12533 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- examples/howto-simple-svg.cxx | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 examples/howto-simple-svg.cxx (limited to 'examples') diff --git a/examples/howto-simple-svg.cxx b/examples/howto-simple-svg.cxx new file mode 100644 index 000000000..28535856c --- /dev/null +++ b/examples/howto-simple-svg.cxx @@ -0,0 +1,67 @@ +// +// "$Id$" +// +// Simple example of how to use an SVG image in an FLTK program. +// Assumes fltk was built with --enable-nanosvg. +// +// Copyright 1998-2010 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// http://www.fltk.org/COPYING.php +// +// Please report all bugs and problems on the following page: +// +// http://www.fltk.org/str.php +// +#include +#include +#include +#include +#include + +/* svg logo */ +const char *svg_logo = + "\n" + "\n" + "\n" + "\n" + "\n" + "\n"; + +int main(int argc, char **argv) { + Fl_SVG_Image *svg = new Fl_SVG_Image(NULL, (char*)strdup(svg_logo)); // XXX: strdup() shouldn't be needed -- see STR #3421 + Fl_Window *win = new Fl_Window(720, 486, "svg test"); + Fl_Box *box = new Fl_Box(10,10,720-20,486-20); + box->image(svg); + win->end(); + win->show(argc,argv); + return(Fl::run()); +} + +// +// End of "$Id$". +// -- cgit v1.2.3