summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-08-27 18:38:56 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-08-27 18:38:56 +0200
commit4a58bf4dc2013c48b948f069520be595466d020b (patch)
tree58cd4e361d4dc2a82153688c480026e2b65986b3 /FL
parent17d155d916010cfa3f55c93e6dab906e362c7680 (diff)
Add example "Fitting an SVG image to a resizable Fl_Box" to doc of Fl_SVG_Image.
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_SVG_Image.H28
1 files changed, 28 insertions, 0 deletions
diff --git a/FL/Fl_SVG_Image.H b/FL/Fl_SVG_Image.H
index 37d41d177..8211a6538 100644
--- a/FL/Fl_SVG_Image.H
+++ b/FL/Fl_SVG_Image.H
@@ -100,6 +100,34 @@ struct NSVGimage;
}
\endcode
+ Example of fitting an svg image to a resizable Fl_Box:
+ \code
+ #include <FL/Fl_Window.H>
+ #include <FL/Fl_SVG_Image.H>
+ #include <FL/Fl_Box.H>
+
+ class resizable_box : public Fl_Box {
+ public:
+ resizable_box(int w, int h) : Fl_Box(0, 0, w, h, NULL) {}
+ virtual void resize(int x, int y, int w, int h) {
+ image()->scale(w, h);
+ Fl_Box::resize(x, y, w, h);
+ }
+ };
+
+ int main(int argc, char **argv) {
+ Fl_Window *win = new Fl_Window(130, 130);
+ resizable_box *box = new resizable_box(win->w(), win->h());
+ Fl_SVG_Image *svg = new Fl_SVG_Image("/path/to/image.svg");
+ box->image(svg);
+ svg->scale(box->w(), box->h());
+ win->end();
+ win->resizable(win);
+ win->show(argc, argv);
+ return Fl::run();
+ }
+ \endcode
+
*/
class FL_EXPORT Fl_SVG_Image : public Fl_RGB_Image {
private: