Skip to content

open_windowOpenWindowOpenWindowopen_windowT_open_window🔗

Short description🔗

open_windowOpenWindowOpenWindowopen_windowT_open_window — Open a graphics window.

Signature🔗

open_window( rectangle.origin.y Row, rectangle.origin.x Column, rectangle.extent.x Width, rectangle.extent.y Height, pointer FatherWindow, string Mode, string Machine, out window WindowHandle )void OpenWindow( const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& FatherWindow, const HTuple& Mode, const HTuple& Machine, HTuple* WindowHandle )static void HOperatorSet.OpenWindow( HTuple row, HTuple column, HTuple width, HTuple height, HTuple fatherWindow, HTuple mode, HTuple machine, out HTuple windowHandle )def open_window( row: int, column: int, width: int, height: int, father_window: Union[int, str], mode: str, machine: str ) -> HHandle

Herror T_open_window( const Htuple Row, const Htuple Column, const Htuple Width, const Htuple Height, const Htuple FatherWindow, const Htuple Mode, const Htuple Machine, Htuple* WindowHandle )

void HWindow::HWindow( Hlong Row, Hlong Column, Hlong Width, Hlong Height, const HTuple& FatherWindow, const HString& Mode, const HString& Machine )

void HWindow::HWindow( Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const HString& Mode, const HString& Machine )

void HWindow::HWindow( Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const char* Mode, const char* Machine )

void HWindow::HWindow( Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const wchar_t* Mode, const wchar_t* Machine ) (Windows only)

public HWindow( int row, int column, int width, int height, HTuple fatherWindow, string mode, string machine )

public HWindow( int row, int column, int width, int height, IntPtr fatherWindow, string mode, string machine )

void HWindow::OpenWindow( Hlong Row, Hlong Column, Hlong Width, Hlong Height, const HTuple& FatherWindow, const HString& Mode, const HString& Machine )

void HWindow::OpenWindow( Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const HString& Mode, const HString& Machine )

void HWindow::OpenWindow( Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const char* Mode, const char* Machine )

void HWindow::OpenWindow( Hlong Row, Hlong Column, Hlong Width, Hlong Height, void* FatherWindow, const wchar_t* Mode, const wchar_t* Machine ) (Windows only)

void HWindow.OpenWindow( int row, int column, int width, int height, HTuple fatherWindow, string mode, string machine )

void HWindow.OpenWindow( int row, int column, int width, int height, IntPtr fatherWindow, string mode, string machine )

Description🔗

open_windowOpenWindow opens a new window, which can be used to perform output of gray value data, regions, graphics as well as to perform textual output. All output (disp_regionDispRegion, disp_imageDispImage, etc.) is redirected to this window, if the same logical window number WindowHandlewindowHandlewindow_handle is used.

The background of the created window is set to black in advance and it has a white border, which is 2 pixels wide (see also set_window_attr(::'border_width',<Width>:)).

Certain parameters used for the editing of output data are assigned to a window. These parameters are considered during the output itself (e.g., with disp_imageDispImage or disp_regionDispRegion). They are not specified by an output operator, but by “configuration operators”. If you want to set, e.g., the color red for the output of regions, you have to call set_color(::WindowHandle,'red':) before calling disp_regionDispRegion. These parameters are always set for the window with the logical window number WindowHandlewindowHandlewindow_handle and remain assigned to a window as long as they will be overwritten. You may use the following configuration operators:

You may query current set values by calling operators like get_shapeGetShape. As some parameters are specified through the hardware (Resolution/Colors), you may query current available resources by calling query_colorQueryColor.

The origin of the coordinate system of the window resides in the upper left corner (coordinates: (0,0)). The row index grows downward (maximal: Heightheightheight-1), the column index grows to the right (maximal: Widthwidthwidth-1). You have to keep in mind, that the range of the coordinate system is independent of the window size. It is specified only through the image format (see reset_obj_dbResetObjDb).

The parameter Machinemachinemachine indicates the name of the computer, which has to open the window. In case of a X-window, TCP-IP only sets the name, DEC-Net sets in addition a colon behind the name. The “server” resp. the “screen” are not specified. If the empty string is passed the environment variable DISPLAY is used. It indicates the target computer. At this the name is indicated in common syntax :0.0.

For windows of type 'WIN32-Window'"WIN32-Window" and 'X-Window'"X-Window" the parameter FatherWindowfatherWindowfather_window can be used to determine the father window for the window to be opened. In case the control ‘father’ is set via set_checkSetCheck, FatherWindowfatherWindowfather_window 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 FatherWindowfatherWindowfather_window is passed the value 0 or ‘root’, then under Windows and Unix-like systems the desktop and the root window become the father window, respectively. In this case, the value of the control ‘father’ (set via set_checkSetCheck) is irrelevant. The caller must ensure that FatherWindowfatherWindowfather_window is a valid handle and not destroyed as long as the embedded HALCON window is used.

You may use the value “-1” for parameters Widthwidthwidth and Heightheightheight. This means, that the according value has to be specified automatically. In particular this is of importance, if the proportion of pixels is not 1.0 (see set_systemSetSystem): Is one of the two parameters set to “-1”, it will be specified through the size which results out of the proportion of pixels. Are both parameters set to “-1”, they will be set to the maximum image format, which is currently used (further information about the currently used maximum image format can be found in the description of get_systemGetSystem using “width” or “height”).

Position and size of a window may change during runtime of a program. This may be achieved by calling set_window_extentsSetWindowExtents, but also through external interferences (window manager). In the latter case the operator set_window_extentsSetWindowExtents is provided.

Opening a window causes the assignment of a called default font. It is used in connection with operators like write_stringWriteString and you may overwrite it by performing set_fontSetFont after calling open_windowOpenWindow. On the other hand you have the possibility to specify a default font by calling set_system(::'default_font',<Fontname>:) before opening a window (and all following windows; see also query_fontQueryFont).

You may set the color of graphics and font, which is used for output operators like disp_regionDispRegion or disp_circleDispCircle, by calling set_rgbSetRgb, set_hsiSetHsi or set_graySetGray.

Normally every output (e.g., disp_imageDispImage, disp_regionDispRegion, disp_circleDispCircle, etc.) in a window is terminated by a called “flush”. This causes the data to be fully visible on the display after termination of the output operator. But this is not necessary in all cases, in particular if there are permanently output tasks or if there is a mouse procedure active. Therefore it is more favorable (i.e., more rapid) to store the data until sufficient data is available. You may stop this behavior by calling set_system(::'flush_graphic','false':).

The content of windows is saved (in case it is supported by special driver software); i.e., it is preserved, also if the window is hidden by other windows. But this is not necessary in all cases: If the content of a window is built up permanently new (copy_rectangleCopyRectangle), you may suppress the security mechanism for that and hence you can save the necessary memory. This is done by calling set_system(::'backing_store','false':) before opening a window. In doing so you save not only memory but also time to compute. This is significant for the output of video clips (see copy_rectangleCopyRectangle).

For graphical output (disp_imageDispImage,disp_regionDispRegion, etc.) you may adjust the window by calling the operator set_partSetPart in order to represent a logical clipping of the image format. In particular this implicates that you obtain this clipping (with appropriate enlargement) of images and regions only.

Difference: graphical window - textual window

  • Using graphical windows the layout is not as variable as concerned to textual windows.

  • You may use textual windows for the input of user data only (read_stringReadString).

  • During the output of images, regions and graphics a “zooming” is performed using graphical windows: Independent on size and side ratio of the window images are transformed in that way, that they are displayed in the window by filling it completely. On the opposite side using textual windows the output does not care about the size of the window (only if clipping is necessary).

  • Using graphical windows the coordinate system of the window corresponds to the coordinate system of the image format. Using textual windows, its coordinate system is always equal to the display coordinates independent on image size.

The parameter Modemodemode determines the mode of the window. It may have following values:

  • ‘visible’: Normal mode for graphical windows: The window is created according to the parameters and all input and output are possible.

  • ‘invisible’: Invisible windows are not displayed in the display. Parameters like Rowrowrow, Columncolumncolumn and FatherWindowfatherWindowfather_window do not have any meaning. Output to these windows has no effect. Input (read_stringReadString, mouse, etc.) is not possible. You may use these windows to query representation parameter for an output device without opening a (visible) window. Common queries are, e.g., query_colorQueryColor and get_string_extentsGetStringExtents.

  • ‘transparent’: These windows are transparent: the window itself is not visible (edge and background), but all the other operations are possible and all output is displayed. A common use for this mode is the creation of mouse sensitive regions.

  • ‘buffer’: These are also not visible windows. The output of images, regions and graphics is not visible on the display, but is stored in memory. Parameters like Rowrowrow, Columncolumncolumn and FatherWindowfatherWindowfather_window do not have any meaning. You may use buffer windows, if you prepare output (in the background) and copy it finally with copy_rectangleCopyRectangle in a visible window. Another usage might be the rapid processing of image regions during interactive manipulations. Textual input and mouse interaction are not possible in this mode.

Attention🔗

You may keep in mind that parameters as Rowrowrow, Columncolumncolumn, Widthwidthwidth and Heightheightheight are constrained by the output device. If you specify a father window (FatherWindowfatherWindowfather_window \(< >\) ‘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🔗

Rowrowrow (input_control) rectangle.origin.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Row index of upper left corner.

Default: 00
Value range: Row (lin)
Minimum increment: 1
Recommended increment: 1

Columncolumncolumn (input_control) rectangle.origin.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Column index of upper left corner.

Default: 00
Value range: Column (lin)
Minimum increment: 1
Recommended increment: 1

Widthwidthwidth (input_control) rectangle.extent.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Width of the window.

Default: 256256
Value range: Width (lin)
Minimum increment: 1
Recommended increment: 1
Restriction: 0 <= Width <= 32768 || Width == -1

Heightheightheight (input_control) rectangle.extent.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Height of the window.

Default: 256256
Value range: Height (lin)
Minimum increment: 1
Recommended increment: 1
Restriction: 0 <= Height <= 32768 || Height == -1

FatherWindowfatherWindowfather_window (input_control) pointer → (integer / string)HTuple (Hlong / HString)HTuple (IntPtr / IntPtr)Union[int, str]Htuple (Hlong / char*)

Logical number of the father window. To specify the display as father you may enter ‘root’ or 0.

Default: 00
Restriction: FatherWindow >= 0

Modemodemode (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Window mode.

Default: 'visible'"visible"
List of values: 'buffer', 'invisible', 'transparent', 'visible'"buffer", "invisible", "transparent", "visible"

Machinemachinemachine (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of the computer on which you want to open the window. Otherwise the empty string.

Default: ''""

WindowHandlewindowHandlewindow_handle (output_control) window → (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

Window handle.

Example🔗

(HDevelop)

open_window(0,0,400,-1,'root','visible','',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)
(C)
open_window(0,0,400,-1,"root","visible","",&WindowHandle)\;
read_image(&Image,"fabrik")\;
disp_image(Image,WindowHandle)\;
write_string(WindowHandle,"File: fabrik")\;
new_line(WindowHandle)\;
get_mbutton(WindowHandle,NULL,NULL,NULL)\;
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(Row1,Column1,Row2,Column2)\;
disp_image(Image,WindowHandle)\;
new_line(WindowHandle)\;

Result🔗

If the values of the specified parameters are correct open_windowOpenWindow returns 2 (H_MSG_TRUE). If necessary an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

reset_obj_dbResetObjDb

Possible successors

set_colorSetColor, query_window_typeQueryWindowType, get_window_typeGetWindowType, set_window_typeSetWindowType, get_mpositionGetMposition, set_tpositionSetTposition, set_tshapeSetTshape, set_window_extentsSetWindowExtents, get_window_extentsGetWindowExtents, query_colorQueryColor, set_checkSetCheck, set_systemSetSystem

See also

disp_regionDispRegion, disp_imageDispImage, disp_colorDispColor, set_lutSetLut, query_colorQueryColor, set_colorSetColor, set_rgbSetRgb, set_hsiSetHsi, set_pixelSetPixel, set_graySetGray, set_partSetPart, set_part_styleSetPartStyle, query_window_typeQueryWindowType, get_window_typeGetWindowType, set_window_typeSetWindowType, get_mpositionGetMposition, set_tpositionSetTposition, set_window_extentsSetWindowExtents, get_window_extentsGetWindowExtents, set_window_attrSetWindowAttr, set_checkSetCheck, set_systemSetSystem

Module🔗

Foundation