new_extern_windowT_new_extern_windowNewExternWindowNewExternWindownew_extern_window (算子)

名称

new_extern_windowT_new_extern_windowNewExternWindowNewExternWindownew_extern_window — 在 Windows 下创建虚拟图形窗口。

签名

new_extern_window( : : WINHWnd, Row, Column, Width, Height : WindowHandle)

Herror T_new_extern_window(const Htuple WINHWnd, const Htuple Row, const Htuple Column, const Htuple Width, const Htuple Height, Htuple* WindowHandle)

void NewExternWindow(const HTuple& WINHWnd, const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, HTuple* WindowHandle)

void HWindow::NewExternWindow(void* WINHWnd, Hlong Row, Hlong Column, Hlong Width, Hlong Height)

static void HOperatorSet.NewExternWindow(HTuple WINHWnd, HTuple row, HTuple column, HTuple width, HTuple height, out HTuple windowHandle)

void HWindow.NewExternWindow(IntPtr WINHWnd, int row, int column, int width, int height)

def new_extern_window(winhwnd: int, row: int, column: int, width: int, height: int) -> HHandle

描述

new_extern_windownew_extern_windowNewExternWindowNewExternWindowNewExternWindownew_extern_window opens a new virtual window. Note that this only works on Windows systems and drawing objects are not supported.

Virtual means that a new window will not be created, but the window whose window handle is given in the parameter WINHWndWINHWndWINHWndWINHWndWINHWndwinhwnd is used to perform output of gray value data, regions, graphics as well as to perform textual output.

All operators that allow the user to define graphical primitives through mouse interactions, like for example draw_rectangle1draw_rectangle1DrawRectangle1DrawRectangle1DrawRectangle1draw_rectangle1, do not work on external windows. The following operators can be used:

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

The parameter WINHWndWINHWndWINHWndWINHWndWINHWndwinhwnd is used to pass the window handle of the window in which output should be done.

The origin of the coordinate system of the window resides in the upper left corner (coordinates: (0,0)). The row index grows downward (maximum: HeightHeightHeightHeightheightheight-1), the column index grows to the right (maximal: WidthWidthWidthWidthwidthwidth-1).

You may use the value -1 for parameters WidthWidthWidthWidthwidthwidth and HeightHeightHeightHeightheightheight. This means, that the corresponding value is chosen automatically. In particular, this is important if the aspect ratio of the pixels is not 1.0 (see set_systemset_systemSetSystemSetSystemSetSystemset_system). If one of the two parameters is set to -1, it will be chosen through the size which results out of the aspect ratio of the pixels. If both parameters are set to -1, they will be set to the current image format.

The position and size of a window may change during runtime of a program, e.g., through external influences (window manager). With the operator set_window_extentsset_window_extentsSetWindowExtentsSetWindowExtentsSetWindowExtentsset_window_extents, you can change the size of the (external) widow via the program. Note that set_window_extentsset_window_extentsSetWindowExtentsSetWindowExtentsSetWindowExtentsset_window_extents offers to change the position as well, but you cannot change the position of an external window under Windows.

Opening a window causes the assignment of a default font. It is used in connection with operators like write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string and you may change it by performing set_fontset_fontSetFontSetFontSetFontset_font after calling open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window。On the other hand, you have the possibility to specify a default font by calling set_system(::'default_font',<Fontname>:)set_system("default_font",<Fontname>)SetSystem("default_font",<Fontname>)SetSystem("default_font",<Fontname>)SetSystem("default_font",<Fontname>)set_system("default_font",<Fontname>) before opening a window (and all following windows; see also query_fontquery_fontQueryFontQueryFontQueryFontquery_font).

You may set the color of graphics and font, which is used for output operators like disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region or disp_circledisp_circleDispCircleDispCircleDispCircledisp_circle, by calling set_rgbset_rgbSetRgbSetRgbSetRgbset_rgb, set_hsiset_hsiSetHsiSetHsiSetHsiset_hsi or set_grayset_graySetGraySetGraySetGrayset_gray。Calling set_insertset_insertSetInsertSetInsertSetInsertset_insert specifies how graphics is combined with the content of the image repeat memory. Thereto you may achieve by calling, e.g., set_insertset_insertSetInsertSetInsertSetInsertset_insert(::'not':) to eliminate the font after writing text twice at the same position.

The content of the window is not saved, if other windows overlap the window. This must be done in the program code that handles the window in the calling program.

For graphical output (disp_imagedisp_imageDispImageDispImageDispImagedisp_image,disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region, etc.) you may adjust the window by calling the operator set_partset_partSetPartSetPartSetPartset_part in order to represent a logical clipping of the image format. In particular this implies that only this part (appropriately scaled) of images and regions is displayed. Before you close your window, you have to close the HALCON-window.

注意

Note that parameters as RowRowRowRowrowrow, ColumnColumnColumnColumncolumncolumn, WidthWidthWidthWidthwidthwidth and HeightHeightHeightHeightheightheight are constrained through the output device, i.e., the size of the Windows NT desktop. Furthermore, be aware that all operators that allow the user to define graphical primitives through mouse interactions, like for example draw_rectangle1draw_rectangle1DrawRectangle1DrawRectangle1DrawRectangle1draw_rectangle1, do not work on external windows.

执行信息

此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。

参数

WINHWndWINHWndWINHWndWINHWndWINHWndwinhwnd (输入控制)  pointer HTupleintHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Windows window handle of a previously created window.

限制: WINHWnd != 0

RowRowRowRowrowrow (输入控制)  rectangle.origin.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row coordinate of upper left corner.

默认值: 0

限制: Row >= 0

ColumnColumnColumnColumncolumncolumn (输入控制)  rectangle.origin.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column coordinate of upper left corner.

默认值: 0

限制: Column >= 0

WidthWidthWidthWidthwidthwidth (输入控制)  rectangle.extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of the window.

默认值: 512

限制: Width > 0 || Width == -1

HeightHeightHeightHeightheightheight (输入控制)  rectangle.extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the window.

默认值: 512

限制: Height > 0 || Height == -1

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (输出控制)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

窗口句柄。

示例 (C++ (HALCON 5.0-10.0))

// Needs to be embedded into an application framework,
// see examples/cpp/mfc/MatchingExtWin.

结果

If the values of the specified parameters are correct new_extern_windownew_extern_windowNewExternWindowNewExternWindowNewExternWindownew_extern_window 返回 2 ( H_MSG_TRUE )。如有必要,则抛出异常。

可能的前趋

reset_obj_dbreset_obj_dbResetObjDbResetObjDbResetObjDbreset_obj_db

可能的后继

set_colorset_colorSetColorSetColorSetColorset_color, query_window_typequery_window_typeQueryWindowTypeQueryWindowTypeQueryWindowTypequery_window_type, get_window_typeget_window_typeGetWindowTypeGetWindowTypeGetWindowTypeget_window_type, set_window_typeset_window_typeSetWindowTypeSetWindowTypeSetWindowTypeset_window_type, get_mpositionget_mpositionGetMpositionGetMpositionGetMpositionget_mposition, set_tpositionset_tpositionSetTpositionSetTpositionSetTpositionset_tposition, set_tshapeset_tshapeSetTshapeSetTshapeSetTshapeset_tshape, set_window_extentsset_window_extentsSetWindowExtentsSetWindowExtentsSetWindowExtentsset_window_extents, get_window_extentsget_window_extentsGetWindowExtentsGetWindowExtentsGetWindowExtentsget_window_extents, query_colorquery_colorQueryColorQueryColorQueryColorquery_color, set_checkset_checkSetCheckSetCheckSetCheckset_check, set_systemset_systemSetSystemSetSystemSetSystemset_system

替代

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window

另见

open_windowopen_windowOpenWindowOpenWindowOpenWindowopen_window, disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region, disp_imagedisp_imageDispImageDispImageDispImagedisp_image, disp_colordisp_colorDispColorDispColorDispColordisp_color, set_lutset_lutSetLutSetLutSetLutset_lut, query_colorquery_colorQueryColorQueryColorQueryColorquery_color, set_colorset_colorSetColorSetColorSetColorset_color, set_rgbset_rgbSetRgbSetRgbSetRgbset_rgb, set_hsiset_hsiSetHsiSetHsiSetHsiset_hsi, set_pixelset_pixelSetPixelSetPixelSetPixelset_pixel, set_grayset_graySetGraySetGraySetGrayset_gray, set_partset_partSetPartSetPartSetPartset_part, set_part_styleset_part_styleSetPartStyleSetPartStyleSetPartStyleset_part_style, query_window_typequery_window_typeQueryWindowTypeQueryWindowTypeQueryWindowTypequery_window_type, get_window_typeget_window_typeGetWindowTypeGetWindowTypeGetWindowTypeget_window_type, set_window_typeset_window_typeSetWindowTypeSetWindowTypeSetWindowTypeset_window_type, get_mpositionget_mpositionGetMpositionGetMpositionGetMpositionget_mposition, set_tpositionset_tpositionSetTpositionSetTpositionSetTpositionset_tposition, set_window_extentsset_window_extentsSetWindowExtentsSetWindowExtentsSetWindowExtentsset_window_extents, get_window_extentsget_window_extentsGetWindowExtentsGetWindowExtentsGetWindowExtentsget_window_extents, set_window_attrset_window_attrSetWindowAttrSetWindowAttrSetWindowAttrset_window_attr, set_checkset_checkSetCheckSetCheckSetCheckset_check, set_systemset_systemSetSystemSetSystemSetSystemset_system

模块

基础