Skip to content

Concept – Drawing🔗

This chapter describes operators that allow the user to manually draw geometric shapes. They require mouse interaction and in general block the application until the mouse interaction is finished. For non-blocking interactive creation of geometric shapes, HALCON also provides drawing objects with the operators listed in Graphics / Object.

General Objectives🔗

The draw operators draw_regionDrawRegion, draw_xldDrawXld, draw_xld_modDrawXldMod, draw_nurbsDrawNurbs, draw_nurbs_modDrawNurbsMod, draw_nurbs_interpDrawNurbsInterp, draw_nurbs_interp_modDrawNurbsInterpMod, as well as drag_region1DragRegion1, drag_region2DragRegion2 and drag_region3DragRegion3 return iconic objects. All other draw operators return the geometric parameters that are needed to create regions or contours in the respective shape (see table). Most draw operators have a modifying variant that allows the user to specify the initial parameters of the shown shape.

Drawing in Buffer Windows🔗

Because the draw operators rely on mouse interaction, they generally do not work when used with buffer windows (see open_windowOpenWindow), so you should use drawing objects instead. Nevertheless some operators (see table) can be used in buffer windows. These operators are controlled through a mouse state. In order to use these operators (and to not cause a deadlock) the application has to provide the mouse state with the operators send_mouse_double_click_eventSendMouseDoubleClickEvent, send_mouse_down_eventSendMouseDownEvent, send_mouse_drag_eventSendMouseDragEvent and send_mouse_up_eventSendMouseUpEvent as well as the state of the modifier keys (also by using send_mouse_drag_eventSendMouseDragEvent), whereas the draw operators themselves must be run in another thread. While using the draw operator, the image section must not be changed.

Drawing Operators Output Generate Object Works in Buffer Windows
draw_pointDrawPoint Rowrowrow, Columncolumncolumn gen_cross_contour_xldGenCrossContourXld yes
draw_lineDrawLine Row1row1row_1, Column1column1column_1, Row2row2row_2, Column2column2column_2 gen_contour_polygon_xldGenContourPolygonXld yes
draw_rectangle1DrawRectangle1 Row1row1row_1, Column1column1column_1, Row2row2row_2, Column2column2column_2 gen_rectangle1GenRectangle1 yes
draw_rectangle2DrawRectangle2 Rowrowrow, Columncolumncolumn, Phiphiphi, Length1length1length_1, Length2length2length_2 gen_rectangle2GenRectangle2, gen_rectangle2_contour_xldGenRectangle2ContourXld yes
draw_circleDrawCircle Rowrowrow, Columncolumncolumn, Radiusradiusradius gen_circleGenCircle, gen_circle_contour_xldGenCircleContourXld yes
draw_ellipseDrawEllipse Rowrowrow, Columncolumncolumn, Phiphiphi, Radius1radius1radius_1, Radius2radius2radius_2 gen_ellipseGenEllipse, gen_ellipse_contour_xldGenEllipseContourXld yes
draw_xldDrawXld Contourcontourcontour - yes
draw_regionDrawRegion Regionregionregion - yes
draw_polygonDrawPolygon Regionregionregion - yes
draw_nurbsDrawNurbs Contourcontourcontour, Rowsrowsrows, Columnscolumnscolumns, Weightsweightsweights - no
draw_nurbs_interpDrawNurbsInterp Contourcontourcontour, Rowsrowsrows, Columnscolumnscolumns, Knotsknotsknots, Tangentstangentstangents - no
drag_region1DragRegion1 Regionregionregion - no
drag_region2DragRegion2 Regionregionregion - no
drag_region3DragRegion3 Regionregionregion - no