Use the tabs on the upper right to switch to a different programming language.

Use the tabs on the upper right to switch to a different programming language.

Use the tabs on the upper right to switch to a different programming language.

Use the tabs on the upper right to switch to a different programming language.

dev_open_windowT_dev_open_windowDevOpenWindowDevOpenWindowdev_open_window (Operator)

Name

dev_open_windowT_dev_open_windowDevOpenWindowDevOpenWindowdev_open_window — Open a new graphics window.

Signature

dev_open_window( : : Row, Column, Width, Height, Background : WindowHandle)

Herror T_dev_open_window(const Htuple Row, const Htuple Column, const Htuple Width, const Htuple Height, const Htuple Background, Htuple* WindowHandle)

void DevOpenWindow(const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, const HTuple& Background, HTuple* WindowHandle)

void HWindow::DevOpenWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, const HTuple& Background)

void HWindow::DevOpenWindow(Hlong Row, Hlong Column, Hlong Width, Hlong Height, Hlong Background)

static void HOperatorSet.DevOpenWindow(HTuple row, HTuple column, HTuple width, HTuple height, HTuple background, out HTuple windowHandle)

void HWindow.DevOpenWindow(int row, int column, int width, int height, HTuple background)

void HWindow.DevOpenWindow(int row, int column, int width, int height, int background)

def dev_open_window(row: int, column: int, width: int, height: int, background: Union[int, str]) -> HHandle

Description

dev_open_windowdev_open_windowDevOpenWindowDevOpenWindowDevOpenWindowdev_open_window opens a new graphics window, which can be used to display iconic objects like images, regions, and lines as well as to perform textual output. This window automatically becomes active, which means that all output (dev_displaydev_displayDevDisplayDevDisplayDevDisplaydev_display and automatic display of operator results) is redirected to this window. This is shown by the lucent lamp on the Active button.

Each graphics window is identified by its WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle. This logical number is displayed in the title bar of the graphics window and is required as input parameter for some operators like disp_imagedisp_imageDispImageDispImageDispImagedisp_image, disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region, draw_circledraw_circleDrawCircleDrawCircleDrawCircledraw_circle, get_mbuttonget_mbuttonGetMbuttonGetMbuttonGetMbuttonget_mbutton, write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string, and set_rgbset_rgbSetRgbSetRgbSetRgbset_rgb.

The graphics window is closed by pressing the Close button of the window frame, via the Visualization menu, or by calling dev_close_windowdev_close_windowDevCloseWindowDevCloseWindowDevCloseWindowdev_close_window.

Graphics Window Position

The graphics window opens either as floating window, or within the canvas window. Once the canvas window is open, all new graphics windows will automatically show up on the canvas. See also “Organizing Graphics Windows on the Canvas” in the “HDevelop User's Guide”.

For floating graphics windows, the parameters RowRowRowRowrowrow and ColumnColumnColumnColumncolumncolumn can be used to set the window’s position. But you have some more options to tweak this position to your needs. One possibility is to change the reference point of the window position which is the upper left desktop corner by default. You can change this reference point with the setting Origin of coordinates. (Edit -> Preferences -> General Options -> General Options -> Origin of coordinates) Moreover, you can adapt the values specified via Window open offset. These values are added to the row and the column index, respectively. See also “Menu Edit” in the “HDevelop User's Guide”.

For graphics windows on the canvas, the parameters RowRowRowRowrowrow and ColumnColumnColumnColumncolumncolumn can be used to arrange the graphics windows relative to each other. An absolute positioning is not possible, because the canvas centers its graphics windows.

Graphics Window Visualization

The background of the created graphics window is set to the color specified in BackgroundBackgroundBackgroundBackgroundbackgroundbackground. This parameter is not available for the operator open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window. There, the same behavior can be achieved by calling set_window_attr(::'background_color',Background:)set_window_attr("background_color",Background)SetWindowAttr("background_color",Background)SetWindowAttr("background_color",Background)SetWindowAttr("background_color",Background)set_window_attr("background_color",Background) in advance.

As a default, the visible image part in the graphics window (viewport) is set in a way that images are displayed without clipping and fitted completely into the window. The image part is adapted to the window's size according to this rule for the first image that is displayed after a program reset or the loading of a new program or if the current image has a different image size than the image that was displayed before. The size of the window is not adapted automatically, hence, if the aspect ratio of the image differs from that of the window, the image is distorted to fit into the window. This can be changed via the Window Size menu.

The visible image part can be changed interactively by spinning the mouse wheel, using the Move or Zoom mode, via the Image Size menu, with the help of the Zoom tab card on the Visualization Parameters dialog, or with the operator dev_set_partdev_set_partDevSetPartDevSetPartDevSetPartdev_set_part.

The display parameters of the graphics window can be specified via its context menu, the Visualization menu, the Visualization Parameters dialog, or the appropriate HDevelop operators like dev_set_colordev_set_colorDevSetColorDevSetColorDevSetColordev_set_color, dev_set_line_widthdev_set_line_widthDevSetLineWidthDevSetLineWidthDevSetLineWidthdev_set_line_width, dev_set_drawdev_set_drawDevSetDrawDevSetDrawDevSetDrawdev_set_draw. Depending on the Apply Immediately preference, the parameter changes are applied to the lastly displayed object or apply from now on for all following objects. In contrast to the standard HALCON window operators, the new settings are also used for all new graphics windows.

Graphics Window History

Each graphics window manages a history which contains the

which have been displayed or changed since the most recent clear action or display of a full image. This history is used if a redraw of the window is triggered, e.g., after a change of the window's size, in order to reconstruct the complete window contents. Other iconic output that was displayed using HALCON operators like disp_imagedisp_imageDispImageDispImageDispImagedisp_image or disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region, text (write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string), or geometric objects (disp_linedisp_lineDispLineDispLineDispLinedisp_line, disp_circledisp_circleDispCircleDispCircleDispCircledisp_circle, etc.) are not part of the history, and can therefore not be redrawn. Only the object classes image, region, and XLD that are displayed with the HDevelop operator dev_displaydev_displayDevDisplayDevDisplayDevDisplaydev_display or by HDevelop actions like double clicking on an icon are part of the history.

Pressing the Clear button clears the graphics window contents and the history of the window. This can also be achieved by using the operator dev_clear_windowdev_clear_windowDevClearWindowDevClearWindowDevClearWindowdev_clear_window. This will not affect the current display parameters.

Further Information

Additional information about the underlying HALCON window can be found at open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window. For more information about the graphics window, please have a look at the “HDevelop User's Guide”.

Attention

Using the code export feature of HDevelop, the code that is generated for this operator may have a different behavior than the related HALCON operator. For a detailed description of the code export of HDevelop graphics operators into the different programming languages see in the “HDevelop User's Guide” the chapter Code Export -> General Aspects of Code Generation -> Graphics Windows.

Parameters

RowRowRowRowrowrow (input_control)  rectangle.origin.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row index of upper left corner.

Default value: 0

Typical range of values: 0 ≤ Row Row Row Row row row

Minimum increment: 1

Recommended increment: 1

Restriction: Row >= 0

ColumnColumnColumnColumncolumncolumn (input_control)  rectangle.origin.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column index of upper left corner.

Default value: 0

Typical range of values: 0 ≤ Column Column Column Column column column

Minimum increment: 1

Recommended increment: 1

Restriction: Column >= 0

WidthWidthWidthWidthwidthwidth (input_control)  rectangle.extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of the window.

Default value: 512

Typical range of values: 0 ≤ Width Width Width Width width width

Minimum increment: 1

Recommended increment: 1

Restriction: Width > 0 || Width == -1

HeightHeightHeightHeightheightheight (input_control)  rectangle.extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the window.

Default value: 512

Typical range of values: 0 ≤ Height Height Height Height height height

Minimum increment: 1

Recommended increment: 1

Restriction: Height > 0 || Height == -1

BackgroundBackgroundBackgroundBackgroundbackgroundbackground (input_control)  integer HTupleUnion[int, str]HTupleHtuple (integer / string) (int / long / string) (Hlong / HString) (Hlong / char*)

Color of the background of the new window.

Default value: 'black' "black" "black" "black" "black" "black"

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (output_control)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Window handle.

Example (HDevelop)

dev_close_window ()
read_image (For5, 'for5')
get_image_size (For5, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
dev_display (For5)
dev_set_lut ('rainbow')
dev_display (For5)
stop ()
dev_set_lut ('default')
dev_display (For5)
stop ()
dev_set_part (100, 100, 300, 300)
dev_display (For5)

Result

If the values of the specified parameters are correct, dev_open_windowdev_open_windowDevOpenWindowDevOpenWindowDevOpenWindowdev_open_window returns TRUE. Otherwise, an exception is raised and an error code returned.

Possible Successors

dev_displaydev_displayDevDisplayDevDisplayDevDisplaydev_display, dev_set_lutdev_set_lutDevSetLutDevSetLutDevSetLutdev_set_lut, dev_set_colordev_set_colorDevSetColorDevSetColorDevSetColordev_set_color, dev_set_drawdev_set_drawDevSetDrawDevSetDrawDevSetDrawdev_set_draw, dev_set_partdev_set_partDevSetPartDevSetPartDevSetPartdev_set_part

Alternatives

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

See also

query_colorquery_colorQueryColorQueryColorQueryColorquery_color

Module

Foundation