| MIL 10 Reference
| Customize Help
| Save Settings

MgraLines



See also
Availability
Available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Draw one or more lines, a polyline, or a polygon in an image, or add them to a graphics list.
Syntax
void MgraLines(
MIL_ID ContextGraId, //in
MIL_ID DstImageBufOrListGraId, //in
MIL_INT NumberOfLinesOrVertices, //in
const MIL_DOUBLE *XPtr, //in
const MIL_DOUBLE *YPtr, //in
const MIL_DOUBLE *X2Ptr, //in
const MIL_DOUBLE *Y2Ptr, //in
MIL_INT64 ControlFlag //in
)
Description

This function draws one or more lines, a polyline, or a polygon destructively (raster-based) in the specified image. Alternatively, this function can add a vector-based version of the lines, polyline, or polygon to the specified graphics list, allowing you to, for example, non-destructively annotate a display without pixelation effects upon scaling.

Lines, polylines, and polygons inherit all the relevant settings of the specified graphics context, such as the foreground color. If part of a line, polyline, or polygon falls outside of the destination image (or, when drawn in a graphics list, the associated display), that part is clipped off.

To modify or inquire graphics context settings, use MgraControl() or MgraInquire(), respectively. To modify or inquire graphics list settings, use MgraControlList() or MgraInquireList(), respectively.

The coordinates of the lines, polyline, or polygon are interpreted with respect to the input coordinate system, specified using MgraControl() or MgraControlList() with M_INPUT_UNITS. Note that if you set your input coordinate system to M_WORLD and you pass MgraLines() an uncalibrated image, the function will generate an error.

To create a single line without the option of creating multiple lines, a polyline, or a polygon, use MgraLine().

Note that prior to MIL 9.0, this function only supported integer positions; the XPtr, YPtr, X2Ptr, and Y2Ptr parameters only accepted arrays of type long. As of MIL 9.0, this function includes support for positions with floating-point precision. To implement this change and maintain backwards compatibility when using a C++ compiler (*.cpp), MgraLines() is available as an inline function which automatically calls MgraLinesDouble(), MgraLinesInt64(), and MgraLinesInt32(), depending on whether XPtr, YPtr, X2Ptr, and Y2Ptr receive arrays of type MIL_DOUBLE, MIL_INT64, or MIL_INT32, respectively. To maintain backwards compatibility when using a C compiler (*.c), MgraLines() maps to MgraLinesInt32() when working on a 32-bit system, or MgraLinesInt64() when working on a 64-bit system; you must explicitly call MgraLinesDouble() to pass XPtr, YPtr, X2Ptr, and Y2Ptr arrays of type MIL_DOUBLE, respectively. If you are an advanced user and want to retrieve a pointer to MgraLines(), you must use the Double, Int64, or Int32 version of this function, since MgraLines() is actually a macro or an overloaded function.

Unlike most other functions that modify a MIL object, you can call this function concurrently from multiple threads on the same MIL graphics list (DstImageBufOrListGraId) without using an M_MUTEX object, as long as all the other parameters of the concurrent calls do not also share data.

Note that when compiling C code, it is suggested to use the type-specific versions of this particular function, rather than the standard function prototype at the top of this page. An exhaustive list of type-specific versions of this function can be found at the bottom of this page.
Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
ContextGraId

Specifies the identifier of the graphics context. This parameter must be set to one of the following values:

function map For specifying the graphics context
CollapseValue Description
Collapse M_DEFAULT

Specifies that the default graphics context of the current MIL application is used.

Note that there is a different default graphics context for each thread.

(summarize)
Collapse MIL graphics context identifier

Specifies the identifier of the graphics context, which you have allocated using the MgraAlloc().

DstImageBufOrListGraId

Specifies the identifier of a valid image buffer in which to draw the lines, polyline, or polygon or the identifier of a valid graphics list in which to add the lines, polyline, or polygon. You must have allocated the image buffer or the graphics list using MbufAlloc...() or MgraAllocList(), respectively.

This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.

NumberOfLinesOrVertices

Specifies the number of lines to draw or add (M_LINE_LIST), or the number of vertices in the polyline or polygon to draw or add (M_POLYGON or M_POLYLINE), according to the array parameters (XPtr, YPtr, X2Ptr, and Y2Ptr).

XPtr

Specifies the address of the array containing the X-coordinate(s) of the start of the lines, or containing the X-coordinates of the vertices in the polyline or polygon, in the input coordinate system. The number of elements in the array should be equal to the NumberOfLinesOrVertices parameter value.

See the Parameter associations section for possible values that can be specified.

YPtr

Specifies the address of the array containing the Y-coordinate(s) of the start of the lines, or containing the Y-coordinates of the vertices in the polyline or polygon, in the input coordinate system. The number of elements in the array should be equal to the NumberOfLinesOrVertices parameter value.

See the Parameter associations section for possible values that can be specified.

X2Ptr

Specifies the address of the array containing the X-coordinate(s) of the end of the lines in the input coordinate system. The number of elements in the array should be equal to the NumberOfLinesOrVertices parameter value. If this information is not required (M_POLYGON and M_POLYLINE), set this parameter to M_NULL.

See the Parameter associations section for possible values that can be specified.

Y2Ptr

Specifies the address of the array containing the Y-coordinate(s) of the end of the lines in the input coordinate system. The number of elements in the array should be equal to the NumberOfLinesOrVertices parameter value. If this information is not required (M_POLYGON and M_POLYLINE), set this parameter to M_NULL.

See the Parameter associations section for possible values that can be specified.

ControlFlag

Specifies the type of line to draw in the image or to add to the graphics list.

See the Parameter associations section for possible values that can be specified.

The table below lists possible values for the XPtr, YPtr, X2Ptr, Y2Ptr, and ControlFlag parameters.

Note that any unused parameters should be set to M_NULL.

function map For specifying the type of line
CollapseControlFlag Description
XPtr
YPtr
X2Ptr
Y2Ptr
Collapse M_DEFAULT
Collapse M_INFINITE_LINES

Specifies a series of infinite lines, each with no start or end points. Each line is defined by two points ((XPtr, YPtr) and (X2Ptr, Y2Ptr)), but the line extends beyond these points.

(summarize)
Collapse XPtr

Specifies the address of the array containing the X-coordinate(s) of the first point used to define a line.

Collapse YPtr

Specifies the address of the array containing the Y-coordinate(s) of the first point used to define a line.

Collapse X2Ptr

Specifies the address of the array containing the X-coordinate(s) of the second point used to define a line.

Collapse Y2Ptr

Specifies the address of the array containing the Y-coordinate(s) of the second point used to define a line.

Collapse M_LINE_LIST

Specifies a series of lines of finite length. Each line is defined with two points ((XPtr, YPtr) and (X2Ptr, Y2Ptr)).

(summarize)
Collapse XPtr

Specifies the address of the array containing the X-coordinate(s) of the first point used to define a line.

Collapse YPtr

Specifies the address of the array containing the Y-coordinate(s) of the first point used to define a line.

Collapse X2Ptr

Specifies the address of the array containing the X-coordinate(s) of the second point used to define a line.

Collapse Y2Ptr

Specifies the address of the array containing the Y-coordinate(s) of the second point used to define a line.

Collapse M_POLYGON +

Specifies a series of connected lines forming a closed polygon. The polygon is defined with two or more vertices (XPtr, YPtr). The final vertex is connected to the first.

(summarize)
Collapse XPtr

Specifies the address of the array containing the X-coordinates of the vertices used to define the polygon.

Collapse YPtr

Specifies the address of the array containing the Y-coordinates of the vertices used to define the polygon.

Collapse M_POLYLINE

Specifies a series of connected lines forming an open polyline. The polyline is defined with two or more vertices (XPtr, YPtr). The final vertex is not connected to the first.

Since the final vertex is not connected to the first, the number of line segments in the polyline is equal to NumberOfLinesOrVertices - 1.

(summarize)
Collapse XPtr

Specifies the address of the array containing the X-coordinates of the vertices used to define the polyline.

Collapse YPtr

Specifies the address of the array containing the Y-coordinates of the vertices used to define the polyline.

Combination constant for M_POLYGON.

You can add the following value to the above-mentioned value to set whether the polygon is filled.

function map For specifying whether the polygon is filled
CollapseCombination value Description
Collapse M_FILLED

Specifies that the polygon is filled with the foreground color of the graphics context.

Type-specific versions of the function
void MgraLinesDouble (MIL_ID ContextGraId, MIL_ID DstImageBufOrListGraId, MIL_INT NumberOfLinesOrVertices, const MIL_DOUBLE *XPtr, const MIL_DOUBLE *YPtr, const MIL_DOUBLE *X2Ptr, const MIL_DOUBLE *Y2Ptr, MIL_INT64 ControlFlag)
Parameters

ContextGraId

See ContextGraId of the main function for a description.

DstImageBufOrListGraId

See DstImageBufOrListGraId of the main function for a description.

NumberOfLinesOrVertices

See NumberOfLinesOrVertices of the main function for a description.

XPtr

See XPtr of the main function for a description.

YPtr

See YPtr of the main function for a description.

X2Ptr

See X2Ptr of the main function for a description.

Y2Ptr

See Y2Ptr of the main function for a description.

ControlFlag

See ControlFlag of the main function for a description.

void MgraLinesInt32 (MIL_ID ContextGraId, MIL_ID DstImageBufOrListGraId, MIL_INT NumberOfLinesOrVertices, const MIL_INT32 *XPtr, const MIL_INT32 *YPtr, const MIL_INT32 *X2Ptr, const MIL_INT32 *Y2Ptr, MIL_INT64 ControlFlag)
Parameters

ContextGraId

See ContextGraId of the main function for a description.

DstImageBufOrListGraId

See DstImageBufOrListGraId of the main function for a description.

NumberOfLinesOrVertices

See NumberOfLinesOrVertices of the main function for a description.

XPtr

See XPtr of the main function for a description.

YPtr

See YPtr of the main function for a description.

X2Ptr

See X2Ptr of the main function for a description.

Y2Ptr

See Y2Ptr of the main function for a description.

ControlFlag

See ControlFlag of the main function for a description.

void MgraLinesInt64 (MIL_ID ContextGraId, MIL_ID DstImageBufOrListGraId, MIL_INT NumberOfLinesOrVertices, const MIL_INT64 *XPtr, const MIL_INT64 *YPtr, const MIL_INT64 *X2Ptr, const MIL_INT64 *Y2Ptr, MIL_INT64 ControlFlag)
Parameters

ContextGraId

See ContextGraId of the main function for a description.

DstImageBufOrListGraId

See DstImageBufOrListGraId of the main function for a description.

NumberOfLinesOrVertices

See NumberOfLinesOrVertices of the main function for a description.

XPtr

See XPtr of the main function for a description.

YPtr

See YPtr of the main function for a description.

X2Ptr

See X2Ptr of the main function for a description.

Y2Ptr

See Y2Ptr of the main function for a description.

ControlFlag

See ControlFlag of the main function for a description.

Compilation information
Header Include mil.h.
Library Use mil.lib.
DLL Requires mil.dll.
DEFAULT NONE DEFAULT INFINITE LINES LINE LIST POLYGON POLYLINE FILLED