From 78908dfe7df5792c334583f93a9f90335c1a6541 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 11 Dec 2025 18:40:14 +0100 Subject: Add "Copy" button to test/pixmap_browser --- test/pixmap_browser.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/pixmap_browser.cxx b/test/pixmap_browser.cxx index 7e97b0b26..01e314036 100644 --- a/test/pixmap_browser.cxx +++ b/test/pixmap_browser.cxx @@ -28,6 +28,7 @@ #include // setlocale().. #include #include +#include #include #include @@ -135,6 +136,17 @@ int arg(int, char **argv, int &i) { return 0; } +void copy_cb(Fl_Widget *, void *) { + if (!img) return; + Fl_Copy_Surface *surface = new Fl_Copy_Surface(img->w(), img->h()); + Fl_Box *tmp = new Fl_Box(FL_NO_BOX, 0, 0, img->w(), img->h(), ""); + tmp->align(FL_ALIGN_IMAGE_BACKDROP); + tmp->image(img); + surface->draw(tmp); + delete tmp; + delete surface; +} + int main(int argc, char **argv) { int i = 1; @@ -160,6 +172,8 @@ int main(int argc, char **argv) { print.callback(print_cb); Fl_Button svg(190,425,100,25,"save as SVG"); svg.callback(svg_cb); + Fl_Button copy(100,425,80,25,"Copy"); + copy.callback(copy_cb); window.show(argc,argv); if (animate) -- cgit v1.2.3