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

draw_linedraw_linedraw_lineDrawLineDrawLine (Operator)

Name

draw_linedraw_linedraw_lineDrawLineDrawLine — Draw a line.

Signature

draw_line( : : WindowHandle : Row1, Column1, Row2, Column2)

Herror draw_line(const Hlong WindowHandle, double* Row1, double* Column1, double* Row2, double* Column2)

Herror T_draw_line(const Htuple WindowHandle, Htuple* Row1, Htuple* Column1, Htuple* Row2, Htuple* Column2)

Herror draw_line(const HTuple& WindowHandle, double* Row1, double* Column1, double* Row2, double* Column2)

double HWindow::DrawLine(HTuple* Column1, HTuple* Row2, HTuple* Column2) const

void HOperatorSetX.DrawLine(
[in] VARIANT WindowHandle, [out] VARIANT* Row1, [out] VARIANT* Column1, [out] VARIANT* Row2, [out] VARIANT* Column2)

double HWindowX.DrawLine(
[out] double* Column1, [out] double* Row2, [out] double* Column2)

static void HOperatorSet.DrawLine(HTuple windowHandle, out HTuple row1, out HTuple column1, out HTuple row2, out HTuple column2)

void HWindow.DrawLine(out double row1, out double column1, out double row2, out double column2)

Description

draw_linedraw_linedraw_lineDrawLineDrawLine returns the parameter for a line, which has been created interactively by the user in the window.

To create a line you have to press the left mouse button determining a start point of the line. While keeping the button pressed you may “drag” the line in any direction. After another mouse click in the middle of the created line you can move it. If you click on one end point of the created line, you may move this point. Pressing the right mousebutton terminates the procedure.

After terminating the procedure the line is not visible in the window any longer.

Parallelization

Parameters

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

Window identifier.

Row1Row1Row1Row1row1 (output_control)  line.begin.y HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Row index of the first point of the line.

Column1Column1Column1Column1column1 (output_control)  line.begin.x HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Column index of the first point of the line.

Row2Row2Row2Row2row2 (output_control)  line.end.y HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Row index of the second point of the line.

Column2Column2Column2Column2column2 (output_control)  line.end.x HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Column index of the second point of the line.

Example (HDevelop)

get_system('width',Width)
get_system('height',Height)
set_part(WindowHandle,0,0,Width-1,Height-1)
read_image(Image,'monkey')
disp_image(Image,WindowHandle)
draw_line(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
fwrite_string(FileHandle,['Clipping = (',Row1,',',Column1,')'])
fwrite_string(FileHandle,[',(',Row2,',',Column2,')'])
fnew_line(FileHandle)

Example (C)

get_system("width",Width) ;
get_system("height",Height) ;
set_part(WindowHandle,0,0,Width-1,Height-1) ;
read_image(&Image,"monkey") ;
disp_image(Image,WindowHandle) ;
draw_line(WindowHandle,&Row1,&Column1,&Row2,&Column2) ;
set_part(WindowHandle,Row1,Column1,Row2,Column2) ;
disp_image(Image,WindowHandle) ;
fwrite_string(FileHandle,"Clipping = (") ;
fwrite_string(FileHandle,Row1) ;
fwrite_string(FileHandle,",") ;
fwrite_string(FileHandle,Column1) ;
fwrite_string(FileHandle,"),(") ;
fwrite_string(FileHandle,Row2) ;
fwrite_string(FileHandle,",") ;
fwrite_string(FileHandle,Column2) ;
fwrite_string(FileHandle,")") ;
fnew_line(FileHandle) ;

Example (HDevelop)

get_system('width',Width)
get_system('height',Height)
set_part(WindowHandle,0,0,Width-1,Height-1)
read_image(Image,'monkey')
disp_image(Image,WindowHandle)
draw_line(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
fwrite_string(FileHandle,['Clipping = (',Row1,',',Column1,')'])
fwrite_string(FileHandle,[',(',Row2,',',Column2,')'])
fnew_line(FileHandle)

Example (HDevelop)

get_system('width',Width)
get_system('height',Height)
set_part(WindowHandle,0,0,Width-1,Height-1)
read_image(Image,'monkey')
disp_image(Image,WindowHandle)
draw_line(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
fwrite_string(FileHandle,['Clipping = (',Row1,',',Column1,')'])
fwrite_string(FileHandle,[',(',Row2,',',Column2,')'])
fnew_line(FileHandle)

Example (HDevelop)

get_system('width',Width)
get_system('height',Height)
set_part(WindowHandle,0,0,Width-1,Height-1)
read_image(Image,'monkey')
disp_image(Image,WindowHandle)
draw_line(WindowHandle,Row1,Column1,Row2,Column2)
set_part(WindowHandle,Row1,Column1,Row2,Column2)
disp_image(Image,WindowHandle)
fwrite_string(FileHandle,['Clipping = (',Row1,',',Column1,')'])
fwrite_string(FileHandle,[',(',Row2,',',Column2,')'])
fnew_line(FileHandle)

Result

draw_linedraw_linedraw_lineDrawLineDrawLine returns 2 (H_MSG_TRUE), if the window is valid and the needed drawing mode (see set_insertset_insertset_insertSetInsertSetInsert) is available. If necessary, an exception is raised.

Possible Predecessors

open_windowopen_windowopen_windowOpenWindowOpenWindow

Possible Successors

reduce_domainreduce_domainreduce_domainReduceDomainReduceDomain, disp_linedisp_linedisp_lineDispLineDispLine, set_coloredset_coloredset_coloredSetColoredSetColored, set_line_widthset_line_widthset_line_widthSetLineWidthSetLineWidth, set_drawset_drawset_drawSetDrawSetDraw, set_insertset_insertset_insertSetInsertSetInsert

See also

draw_line_moddraw_line_moddraw_line_modDrawLineModDrawLineMod, gen_rectangle1gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1, draw_circledraw_circledraw_circleDrawCircleDrawCircle, draw_ellipsedraw_ellipsedraw_ellipseDrawEllipseDrawEllipse, set_insertset_insertset_insertSetInsertSetInsert

Module

Foundation


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