generates a bitmap image of a graphical figure, including its uicontrols (and window borders)
gui2bitmap(idFig, filename) gui2bitmap(idFig, filename, withBorders) gui2bitmap("setMenu", parentHandle) gui2bitmap("setBorders", borders) gui2bitmap("setScale", scale)
filename
.![]() | With Scilab 6, this must be done before plotting anything in the
figure (due to the
bug 16167). |
withBorders
option is used. Default = [%T %T %T].gui2bitmap(…)
takes a snapshot of the given graphical figure and
stores it in an image file.
gui2bitmap(…)
is a stand-alone Scilab function using only
the JVM embedded in Scilab. It does not require any external software.
It aims to replace xs2png(…)
, xs2jpg(…)
, xs2gif(…)
, and xs2bmp(…)
. Unlike them,
it is able to
Since it uses the JVM, gui2bitmap()
can be used in standard
STD
Scilab desktop and in No-Window NW
(advanced console) modes, but is not available in NWNI
batch mode.
gui2bitmap("setMenu", parentHandle)
adds a menu to the console, or a submenu to a given figure (to its
File menu) or an existing menu, according to the
parentHandle
value.
Before calling gui2bitmap(), the file explorer is opened and prompts the user to choose the filename and directory of the image file.
When the menu is added to the console, gui2bitmap() actions apply to the active figure, that is blinked before processing.
This command is ignored in NW execution mode.
gui2bitmap("setScale", scale)
sets the screen display scale, as configuration parameter. The value is recorded in the file SCIHOME/gui2bitmap_preferences.xml and is used by gui2bitmap() for all forthcoming calls and Scilab sessions.
gui2bitmap("setBorders", borders)
indicates which window borders must be include in the image when gui2bitmap() is called
with the withBorders
option. The borders
boolean
vector is recorded as configuration parameter in the file SCIHOME/gui2bitmap_preferences.xml and is used by gui2bitmap() for all
forthcoming calls and Scilab sessions.
This setting is useful for instance to trim transparent borders, with [%F %F %F].
![]() | No variable named File, Robot, or Rectangle must exist anywhere in the calling level of gui2bitmap() (and in the upper callers, if any). |
// Generate a nice GUI (from demos) exec("SCI/modules/gui/demos/uicontrol_plot3d.dem.sce",-1); // f = gcf(); f.axes_size = [650 400]; sleep(500) figGUI = "TMPDIR/gui2bitmap/gui2bitmap.png"; // Export the window gui2bitmap(f, figGUI, %t) // with window borders // Let's see the image winopen(figGUI) sleep(500) // Now without the window borders: gui2bitmap(f, figGUI) winopen(figGUI) close(f); rmdir(fileparts(figGUI)); | ![]() | ![]() |
Finally, let's trim the left, bottom and right borders, but keep the heading area and the status bar at the bottom :
xdel(winsid()) exec("SCI/modules/gui/demos/uicontrol_plot3d.dem.sce",-1); f = gcf(); f.axes_size = [650 400]; f.infobar_visible = "on"; figGUI = "TMPDIR/gui2bitmap/gui2bitmap.png"; gui2bitmap("setBorders", [%F %F %F]) gui2bitmap(gcf(), figGUI, %t); // Let's see the image winopen(figGUI) // Restore the default borders setting gui2bitmap("setBorders", [%T %T %T]) | ![]() | ![]() |
Let's add a gui2bitmap menu to the console, and use it:
xdel(winsid()) plot exec("SCI/modules/gui/demos/uicontrol_plot3d.dem.sce",-1); // Two graphical windows are now defined. The active one is the plot3d GUI. gui2bitmap("setMenu",get(0)); // Look at the console's menu bar => gui2bitmap menu. // Use it and see how it proceeds. | ![]() | ![]() |
Samuel GOUGEON
Version | Description |
1.0 | 2019-08-02 : First release |
1.1 | 2019-08-05 :
|
1.2 | 2019-08-09 :
|