| Customize Help
| Save Settings

MgraRect



Function Map
Synopsis
Draw a rectangle in an image without rotation or fill color, or add it to a 2D graphics list.
Syntax
void MgraRect(
MIL_ID ContextGraId, //in
MIL_ID DstImageBufOrListGraId, //in
MIL_DOUBLE XStart, //in
MIL_DOUBLE YStart, //in
MIL_DOUBLE XEnd, //in
MIL_DOUBLE YEnd //in
)
Description

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

The rectangle is created from the top-left corner (XStart, YStart) to the bottom-right corner (XEnd, YEnd). The rectangle inherits all the relevant settings of the specified 2D graphics context, such as the foreground color (see MgraAlloc() for default context settings). If part of the rectangle falls outside of the specified area (image or display), that part is clipped off.

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

A rectangle's coordinates 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 MgraRect() an uncalibrated image, the function will generate an error.

To create a filled rectangle, use MgraRectFill(). To create a rectangle that can be optionally filled and rotated, use MgraRectAngle().

Unlike most other functions that modify a MIL object, you can call this function concurrently from multiple threads on the same MIL 2D 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 using a C compiler (not a C++ or other compiler) in 64-bit mode, MgraRect() internally calls the MIL_DOUBLE version of this function (MgraRectDouble()). If you need to pass integer values, call the MIL_INT64 version of this function (MgraRectInt64()).
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 which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
ContextGraId

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

function map For specifying the 2D graphics context
Click to summarizeValue Description
Click to summarize M_DEFAULT

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

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

(summarize)
Click to summarize MIL 2D graphics context identifier

Specifies a valid 2D graphics context identifier, which you have allocated using MgraAlloc().

DstImageBufOrListGraId

Specifies the identifier of a valid image buffer in which to draw the rectangle or the identifier of a valid 2D graphics list in which to add the rectangle. You must have allocated the image buffer or the 2D 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.

XStart

Specifies the X-coordinate of the top-left corner of the rectangle in the input coordinate system.

YStart

Specifies the Y-coordinate of the top-left corner of the rectangle in the input coordinate system.

XEnd

Specifies the X-coordinate of the bottom-right corner of the rectangle in the input coordinate system.

YEnd

Specifies the Y-coordinate of the bottom-right corner of the rectangle in the input coordinate system.

Type-specific versions of the function when using a C compiler under 64-bit
void MgraRectDouble (MIL_ID ContextGraId, MIL_ID DstImageBufOrListGraId, MIL_DOUBLE XStart, MIL_DOUBLE YStart, MIL_DOUBLE XEnd, MIL_DOUBLE YEnd)
Parameters

ContextGraId

See ContextGraId of the main function for a description.

DstImageBufOrListGraId

See DstImageBufOrListGraId of the main function for a description.

XStart

See XStart of the main function for a description.

YStart

See YStart of the main function for a description.

XEnd

See XEnd of the main function for a description.

YEnd

See YEnd of the main function for a description.

void MgraRectInt64 (MIL_ID ContextGraId, MIL_ID DstImageBufOrListGraId, MIL_INT64 XStart, MIL_INT64 YStart, MIL_INT64 XEnd, MIL_INT64 YEnd)
Parameters

ContextGraId

See ContextGraId of the main function for a description.

DstImageBufOrListGraId

See DstImageBufOrListGraId of the main function for a description.

XStart

See XStart of the main function for a description.

YStart

See YStart of the main function for a description.

XEnd

See XEnd of the main function for a description.

YEnd

See YEnd of the main function for a description.

Compilation information
Header Include mil.h.
Library Use mil.lib.
DLL Requires mil.dll.
DEFAULT NONE