HALCON Reference Manual 10.0.2
Table of Contents / Graphics / Window ClassesClassesClasses | | | Operators

new_extern_windownew_extern_windownew_extern_windowNewExternWindowNewExternWindow (Operator)

Name

new_extern_windownew_extern_windownew_extern_windowNewExternWindowNewExternWindow — Create a virtual graphics window under Windows.

Signature

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

Herror new_extern_window(const Hlong WINHWnd, const Hlong Row, const Hlong Column, const Hlong Width, const Hlong Height, Hlong* WindowHandle)

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

Herror new_extern_window(const HTuple& WINHWnd, const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height, Hlong* WindowHandle)

Hlong HWindow::NewExternWindow(const HTuple& WINHWnd, const HTuple& Row, const HTuple& Column, const HTuple& Width, const HTuple& Height) const

void HOperatorSetX.NewExternWindow(
[in] VARIANT WINHWnd, [in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Width, [in] VARIANT Height, [out] VARIANT* WindowHandle)

void HWindowX.NewExternWindow(
[in] Hlong WINHWnd, [in] Hlong Row, [in] Hlong Column, [in] Hlong Width, [in] 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)

Description

new_extern_windownew_extern_windownew_extern_windowNewExternWindowNewExternWindow opens a new virtual window. Virtual means that a new window will not be created, but the window whose Windows handle is given in the parameter WINHWndWINHWndWINHWndWINHWndWINHWnd is used to perform output of gray value data, regions, graphics as well as to perform textual output. Visualization parameters for the output of data can be done either using HALCON commands or by the appropriate Windows commands.

Example: setting of the drawing color:

HALCON:

set_color(WindowHandle,"green");

disp_region(WindowHandle,region);

Windows:

HPEN* penold;

HPEN penGreen = CreatePen(PS_SOLID,1,RGB(0,255,0));

pen = (HPEN*)SelectObject(WINHDC,penGreen);

disp_region(WindowHandle,region);

Interactive operators, for example draw_regiondraw_regiondraw_regionDrawRegionDrawRegion, draw_circledraw_circledraw_circleDrawCircleDrawCircle could have displaying problems during a refresh of the window. The following operators can be used:

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

The parameter WINHWndWINHWndWINHWndWINHWndWINHWnd 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: HeightHeightHeightHeightheight-1), the column index grows to the right (maximal: WidthWidthWidthWidthwidth-1).

You may use the value -1 for parameters WidthWidthWidthWidthwidth and HeightHeightHeightHeightheight. 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_systemset_systemSetSystemSetSystem). 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_extentsset_window_extentsSetWindowExtentsSetWindowExtents, you can change the size of the (external) widow via the program. Note that set_window_extentsset_window_extentsset_window_extentsSetWindowExtentsSetWindowExtents 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_stringwrite_stringWriteStringWriteString and you may change it by performing set_fontset_fontset_fontSetFontSetFont after calling open_windowopen_windowopen_windowOpenWindowOpenWindow. 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>)set_system("default_font",<Fontname>)SetSystem("default_font",<Fontname>)SetSystem("default_font",<Fontname>) before opening a window (and all following windows; see also query_fontquery_fontquery_fontQueryFontQueryFont).

You may set the color of graphics and font, which is used for output operators like disp_regiondisp_regiondisp_regionDispRegionDispRegion or disp_circledisp_circledisp_circleDispCircleDispCircle, by calling set_rgbset_rgbset_rgbSetRgbSetRgb, set_hsiset_hsiset_hsiSetHsiSetHsi, set_grayset_grayset_graySetGraySetGray or set_pixelset_pixelset_pixelSetPixelSetPixel. Calling set_insertset_insertset_insertSetInsertSetInsert specifies how graphics is combined with the content of the image repeat memory. Thereto you may achieve by calling, e.g., set_insertset_insertset_insertSetInsertSetInsert(::'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_imagedisp_imageDispImageDispImage,disp_regiondisp_regiondisp_regionDispRegionDispRegion, etc.) you may adjust the window by calling the operator set_partset_partset_partSetPartSetPart 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.

Steps to use new_extern_window:

Creation:

Use:

Destroy:

Attention

Note that parameters as RowRowRowRowrow, ColumnColumnColumnColumncolumn, WidthWidthWidthWidthwidth and HeightHeightHeightHeightheight are constrained through the output device, i.e., the size of the Windows NT desktop.

Parallelization

Parameters

WINHWndWINHWndWINHWndWINHWndWINHWnd (input_control)  pointer HTupleHTupleVARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Windows windowhandle of a previously created window.

Restriction: WINHWnd != 0

RowRowRowRowrow (input_control)  rectangle.origin.y HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Row coordinate of upper left corner.

Default value: 0

Restriction: Row >= 0

ColumnColumnColumnColumncolumn (input_control)  rectangle.origin.x HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Column coordinate of upper left corner.

Default value: 0

Restriction: Column >= 0

WidthWidthWidthWidthwidth (input_control)  rectangle.extent.x HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Width of the window.

Default value: 512

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

HeightHeightHeightHeightheight (input_control)  rectangle.extent.y HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Height of the window.

Default value: 512

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

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (output_control)  window HWindow, HTupleHTupleHWindowX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Window identifier.

Example (C++)

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

Result

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

Possible Predecessors

reset_obj_dbreset_obj_dbreset_obj_dbResetObjDbResetObjDb

Possible Successors

set_colorset_colorset_colorSetColorSetColor, query_window_typequery_window_typequery_window_typeQueryWindowTypeQueryWindowType, get_window_typeget_window_typeget_window_typeGetWindowTypeGetWindowType, set_window_typeset_window_typeset_window_typeSetWindowTypeSetWindowType, get_mpositionget_mpositionget_mpositionGetMpositionGetMposition, set_tpositionset_tpositionset_tpositionSetTpositionSetTposition, set_tshapeset_tshapeset_tshapeSetTshapeSetTshape, set_window_extentsset_window_extentsset_window_extentsSetWindowExtentsSetWindowExtents, get_window_extentsget_window_extentsget_window_extentsGetWindowExtentsGetWindowExtents, query_colorquery_colorquery_colorQueryColorQueryColor, set_checkset_checkset_checkSetCheckSetCheck, set_systemset_systemset_systemSetSystemSetSystem

Alternatives

open_windowopen_windowopen_windowOpenWindowOpenWindow, open_textwindowopen_textwindowopen_textwindowOpenTextwindowOpenTextwindow

See also

open_windowopen_windowopen_windowOpenWindowOpenWindow, disp_regiondisp_regiondisp_regionDispRegionDispRegion, disp_imagedisp_imagedisp_imageDispImageDispImage, disp_colordisp_colordisp_colorDispColorDispColor, set_lutset_lutset_lutSetLutSetLut, query_colorquery_colorquery_colorQueryColorQueryColor, set_colorset_colorset_colorSetColorSetColor, set_rgbset_rgbset_rgbSetRgbSetRgb, set_hsiset_hsiset_hsiSetHsiSetHsi, set_pixelset_pixelset_pixelSetPixelSetPixel, set_grayset_grayset_graySetGraySetGray, set_partset_partset_partSetPartSetPart, set_part_styleset_part_styleset_part_styleSetPartStyleSetPartStyle, query_window_typequery_window_typequery_window_typeQueryWindowTypeQueryWindowType, get_window_typeget_window_typeget_window_typeGetWindowTypeGetWindowType, set_window_typeset_window_typeset_window_typeSetWindowTypeSetWindowType, get_mpositionget_mpositionget_mpositionGetMpositionGetMposition, set_tpositionset_tpositionset_tpositionSetTpositionSetTposition, set_window_extentsset_window_extentsset_window_extentsSetWindowExtentsSetWindowExtents, get_window_extentsget_window_extentsget_window_extentsGetWindowExtentsGetWindowExtents, set_window_attrset_window_attrset_window_attrSetWindowAttrSetWindowAttr, set_checkset_checkset_checkSetCheckSetCheck, set_systemset_systemset_systemSetSystemSetSystem

Module

Foundation


Table of Contents / Graphics / Window ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH