open_runtime_windowπ
Short descriptionπ
open_runtime_window β Open a graphics window.
Signatureπ
open_runtime_window( dict GenParam, out window WindowHandle )
Descriptionπ
open_runtime_window opens a new window that can be used to output
gray value data, regions, and graphics, as well as for text output. All
output (disp_region, disp_image, etc.) is directed to this
window if the same logical window number WindowHandle is used.
In contrast to the operator open_window, which also opens a new
window, open_runtime_window takes the parameters used to create the
window from the GenParam dictionary.
The GenParam dictionary accepts the following keys:
-
'x', 'y': The x/y coordinates of the upper left corner of the window on the screen as an integer value. If these keys are not supplied in the dictionary, 0 is used by default.
-
'width', 'height': The width/height of the window in pixels as an integer value. If these keys are not supplied in the dictionary, the maximum image width/height is used by default (further information about the currently used maximum image width and height can be found in the description of
set_systemfor the values 'width' and 'height').You may use the value -1 for the keys 'width' and 'height'. This tells
open_runtime_windowto determine the value to use automatically. In particular this is of importance, if the proportion of pixels is not \(1.0\) (seeset_system). If only one of the two parameters is set to -1, the value is determined by the size resulting from the pixel aspect ratio. If both parameters are set to -1, width and height will be set to the current maximum image width and height. -
'mode': The mode of the window to open. It may have the following values:
-
'visible': This is the standard mode for graphics windows. The window is created according to the specified parameters, and all input and output operations are possible.
-
'invisible': Invisible windows are not displayed on the screen. The keys 'x', 'y' and 'father' have no effect. Output to these windows has no effect, and input (
read_string, mouse, etc.) is not possible. These windows are used to query display parameters for an output device without opening a (visible) window. Typical queries are, e.g.,query_colororget_string_extents. -
'buffer': These are also invisible windows. The output of images, regions and graphics is not visible on the screen but is buffered in memory. The keys 'x', 'y' and 'father' have no effect. Buffer windows are used, for example, to prepare output (in the background) and then copy it into a visible window using
copy_rectangle. Another use case is the fast processing of image sections during interactive manipulations. Text input and mouse interaction are not possible in 'buffer' mode.
If this key is not present in the dictionary, the mode 'visible' is used by default.
-
-
'father': This key specifies the father window to embed the new window in. If the control mode 'father' is set via
set_check, 'father' must be the ID of a HALCON window, otherwise (texttt{set_check(::β~fatherβ:)}) it can also be the ID of an operating system window.If this key is not present in the dictionary, or the values 0 or 'root' are used, the father window is the desktop.
This parameter is ignored on platforms other than Windows or Linux.
Unknown keys are silently ignored.
Position and size of a window may change during runtime of a program. This
can happen by calling set_window_extents, or externally through the
windowing system.
Applications using HALCON can override the behavior of
open_runtime_window for windows with a 'father' of
0 and a 'mode' of 'visible'. In this case the
operator may take additional keys in the GenParam dictionary, or
interpret the documented keys differently.
Attentionπ
Note that the keys 'x', 'y', 'width' and 'height' are limited by the output device. If you specify a father window ('father' \(< >\) βrootβ), the coordinates are relative to this window.
Execution informationπ
Execution information
-
Multithreading type: reentrant (runs in parallel with non-exclusive operators).
-
Multithreading scope: global (may be called from any thread).
-
Processed without parallelization.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
Parametersπ
GenParam (input_control) dict β (handle)
Parameter dictionary containing the window parameters to use.
Default: []
WindowHandle (output_control) window β (handle)
Window handle.
Exampleπ
(HDevelop)
Params := dict{}
Params.width := 400
Params.height := -1
Params.mode := 'visible'
open_runtime_window (Params, WindowHandle)
read_image (Image, 'fabrik')
disp_image(Image,WindowHandle)
write_string(WindowHandle,'File, fabrik')
new_line(WindowHandle)
get_mbutton(WindowHandle,_,_,_)
set_lut(WindowHandle,'temperature')
set_color(WindowHandle,'blue')
write_string(WindowHandle,'temperature')
new_line(WindowHandle)
write_string(WindowHandle,'Draw Rectangle')
new_line(WindowHandle)
draw_rectangle1(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
new_line(WindowHandle)
Resultπ
If the parameter values are correct, open_runtime_window returns
2 (H_MSG_TRUE). Otherwise, an exception is raised.
Combinations with other operatorsπ
Moduleπ
Foundation