diff libgui/graphics/Figure.cc @ 23535:2aab625b502c

Add getframe function for opengl based toolkits (bug #48195) * graphics.in.h (graphics_toolkit::get_pixels, base_graphics_toolkit::get_pixels): new virtual methods * graphics.cc (F__get_frame__): new function. * Backend.h/cc (Backend::get_pixels): implement new method * ObjectProxy.h/cc (ObjectProxy::get_pixels): new method, invoke directly Figure object slotGetPixels in Qt::BlockingQueuedConnection mode * Figure.h/cc (Figure::slotGetPixels): new public slot * Canvas.h (Canvas::getPixels, Canvas::do_getPixels): new methods * GLCanvas.h/cc (GLCanvas::do_getPixels): reimplemented method, use opengl_renderer to draw object and get_pixels * __init_fltk__.cc (fltk_graphics_toolkit::get_pixels, figure_manager::get_pixels, figure_manager::do_get_pixels, plot_window::get_pixels, OpenGL_fltk::get_pixels): new methods * gl-renderer.h/cc (opengl_renderer::get_pixels): new method, read pixels in the current opengl scene * getframe.m: new function file * image.txi: add getframe doc * NEWS: announce new function
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Tue, 23 May 2017 15:01:27 +0200
parents c763214a8260
children 80c42f4cca13
line wrap: on
line diff
--- a/libgui/graphics/Figure.cc	Sat May 27 09:59:32 2017 -0700
+++ b/libgui/graphics/Figure.cc	Tue May 23 15:01:27 2017 +0200
@@ -395,6 +395,22 @@
       canvas->print (file_cmd, term);
   }
 
+  uint8NDArray
+  Figure::slotGetPixels (void)
+  {
+    uint8NDArray retval;
+    Canvas *canvas = m_container->canvas (m_handle);
+
+    if (canvas)
+      {
+        gh_manager::process_events ();
+        gh_manager::auto_lock lock;
+        retval = canvas->getPixels ();
+      }
+
+    return retval;
+  }
+
   void
   Figure::beingDeleted (void)
   {