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 |
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.
Specifies the identifier of the graphics context. This parameter must be set to one of the following values:
For specifying the graphics
context
|
|||||||||||||||||||||||||||||||||||||||
Value | Description
|
||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Specifies that the default graphics context of the current MIL application is used. (more details...) |
||||||||||||||||||||||||||||||||||||||
MIL graphics context identifier |
Specifies the identifier of the graphics context, which you have allocated using the MgraAlloc(). |
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.
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).
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.
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.
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.
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.
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.
For specifying the type of
line
|
|||||||||||||||||||||||||||||||||||||||
ControlFlag |
Description
|
||||||||||||||||||||||||||||||||||||||
XPtr | |||||||||||||||||||||||||||||||||||||||
YPtr | |||||||||||||||||||||||||||||||||||||||
X2Ptr | |||||||||||||||||||||||||||||||||||||||
Y2Ptr | |||||||||||||||||||||||||||||||||||||||
M_DEFAULT |
Same as M_LINE_LIST. (more details...) |
||||||||||||||||||||||||||||||||||||||
M_INFINITE_LINES |
Specifies a series of infinite lines, each with no start or end points. (more details...) |
||||||||||||||||||||||||||||||||||||||
XPtr |
Specifies the address of the array containing the X-coordinate(s) of the first point used to define a line. |
||||||||||||||||||||||||||||||||||||||
YPtr |
Specifies the address of the array containing the Y-coordinate(s) of the first point used to define a line. |
||||||||||||||||||||||||||||||||||||||
X2Ptr |
Specifies the address of the array containing the X-coordinate(s) of the second point used to define a line. |
||||||||||||||||||||||||||||||||||||||
Y2Ptr |
Specifies the address of the array containing the Y-coordinate(s) of the second point used to define a line. |
||||||||||||||||||||||||||||||||||||||
M_LINE_LIST |
Specifies a series of lines of finite length. (more details...) |
||||||||||||||||||||||||||||||||||||||
XPtr |
Specifies the address of the array containing the X-coordinate(s) of the first point used to define a line. |
||||||||||||||||||||||||||||||||||||||
YPtr |
Specifies the address of the array containing the Y-coordinate(s) of the first point used to define a line. |
||||||||||||||||||||||||||||||||||||||
X2Ptr |
Specifies the address of the array containing the X-coordinate(s) of the second point used to define a line. |
||||||||||||||||||||||||||||||||||||||
Y2Ptr |
Specifies the address of the array containing the Y-coordinate(s) of the second point used to define a line. |
||||||||||||||||||||||||||||||||||||||
M_POLYGON + |
Specifies a series of connected lines forming a closed polygon. (more details...) |
||||||||||||||||||||||||||||||||||||||
XPtr |
Specifies the address of the array containing the X-coordinates of the vertices used to define the polygon. |
||||||||||||||||||||||||||||||||||||||
YPtr |
Specifies the address of the array containing the Y-coordinates of the vertices used to define the polygon. |
||||||||||||||||||||||||||||||||||||||
M_POLYLINE |
Specifies a series of connected lines forming an open polyline. (more details...) |
||||||||||||||||||||||||||||||||||||||
XPtr |
Specifies the address of the array containing the X-coordinates of the vertices used to define the polyline. |
||||||||||||||||||||||||||||||||||||||
YPtr |
Specifies the address of the array containing the Y-coordinates of the vertices used to define the polyline. |
You can add the following value to the above-mentioned value to set whether the polygon is filled.
For specifying whether the polygon is
filled
|
|||||||||||||||||||||||||||||||||||||||
Combination value | Description
|
||||||||||||||||||||||||||||||||||||||
M_FILLED |
Specifies that the polygon is filled with the foreground color of the graphics context. |
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. |
Header | Include mil.h. |
Library | Use mil.lib. |
DLL | Requires mil.dll. |