| MIL 10 Reference
| Customize Help
| Save Settings

McodeDraw



See also
Availability
Not 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 specific features of results obtained from a code read or grading operation.
Syntax
void McodeDraw(
MIL_ID ContextGraId, //in
MIL_ID ResultCodeId, //in
MIL_ID DstImageBufOrListGraId, //in
MIL_INT64 Operation, //in
MIL_INT ResultIndex, //in
MIL_INT64 ControlFlag //in
)
Description

This function draws specific features of results, obtained from a code read or grading operation, in the specified destination image buffer or graphics list. Results are only available after calling McodeRead() or McodeGrade().

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 to use when drawing. 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 a valid graphics context identifier, which you have allocated using MgraAlloc().

ResultCodeId

Specifies the code result buffer from which to extract features to draw. The code result buffer must have been previously allocated on the required system using McodeAllocResult().

DstImageBufOrListGraId

Specifies the identifier of the destination image buffer or graphics list in which to write specific features of results.

If specifying an image buffer, it must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error. The image buffer must be an 8-bit, unsigned, 1-band image buffer, allocated using MbufAlloc...().

In general, the destination image buffer should be the same size as the image that you just read. When dealing with reflectance profiles (using M_DRAW_REFLECTANCE_PROFILE), determine the required width (using McodeGetResult() or McodeGetResultSingle() with M_SCAN_REFLECTANCE_PROFILE_LENGTH. For best results, the height of a scan reflectance profile buffer must be 256.

If you specify a graphics list, the graphics list must have been previously allocated using MgraAllocList().

By drawing into the display's overlay buffer or associating the graphics list with the display, you can also annotate an image non-destructively.

Operation

Specifies the type of operation to perform. Operations can be added together to draw multiple features at a time. For example, to draw both the result occurrence's position and a bounding box around the code, set the Operation parameter to M_DRAW_POSITION + M_DRAW_BOX.

The following types of operations are only available after a read operation, with McodeRead().

function map For specifying the type of operation after a read operation
CollapseValue Description
Collapse M_DRAW_CODE +

Draws the specified code as it was read by McodeRead().

This operation is not supported for GS1 Databar, MicroPDF417, and composite code types.

(summarize)
Collapse M_DRAW_POSITION +

Draws a cross-like symbol at the mid-point of the code. Note that for Data matrix codes, the cross symbol is drawn in the middle of the top left cell. For composite codes, the cross is drawn at the midpoint of the 1D part of the code. For Maxicodes, the cross appears in the center of the bull's eye pattern. Regardless of the code type, the cross is drawn maintaining the angle of the occurrence.

(summarize)

The following operations are only available after a grading operation, with McodeGrade().

function map For specifying the type of operation after a grading operation
CollapseValue Description
Collapse M_DRAW_EXTENDED_AREA +

Draws a box around the specified code including its extended area, as analyzed by the grading operation.

Note that M_EXTENDED_AREA_REFLECTANCE_CHECK must be enabled for the extended area to be available to be drawn after a grading operation.

To establish the dimensions of the extended area, use McodeGetResult...() with M_EXTENDED_AREA_TOP... and M_EXTENDED_AREA_BOTTOM.... The bounding box only contains the part of the code that was processed in the read or grading operation.

(summarize)
Collapse M_DRAW_REFLECTANCE_PROFILE +

Draws the scan reflectance profile of the code, as analyzed by the grading operation.

The result is not scaled to the size of the destination image buffer.

(summarize)
Collapse M_DRAW_SCAN_PROFILES +

Draws the scan profile of the code, as analyzed by the grading operation.

The drawn scan profile represents only the regions from which the results are successfully read and computed.

(summarize)
Combination constants for the values listed in For specifying the type of operation after a grading operation.

You can add one of the following values to the above-mentioned values to get the grading result of a composite code.

function map Composite code grading results
CollapseCombination value Description
Collapse M_2D_COMPONENT +

Draws the grading result of the 2D component of the composite code.

Collapse M_LINEAR_COMPONENT +

Draws the grading result of the linear component of the composite code.

Combination constants that can be used alone or as combination constants for the values listed in all the values group tables.

You can use one or more of the following values in combination with each other or with the above-mentioned values, to specify an operation that is available after either a read or grading operation.

The following type of operations are only available after a read operation, with McodeRead(), or a grading operation, with McodeGrade().

function map For specifying an operation that is available after either a read or grading operation
CollapseValue Description
Collapse M_DRAW_BOX

Draws a box around the code occurrence. This box is drawn according to the corner coordinates of the code that was read or graded. You can retrieve these coordinates using McodeGetResult...() with M_BOTTOM... and M_TOP.... The bounding box only contains the part of the code that was processed in the read or grading operation. When dealing with composite codes, the box is drawn around the 1D part of the code.

When drawing an occurrence, the bounding box is drawn maintaining the angle and scale of the occurrence.

(summarize)
Collapse M_DRAW_QUIET_ZONE

Draws a box around the specified code including its quiet zone, as analyzed by the read or grading operation.

Note that M_CHECK_QUIET_ZONE must be enabled for the quiet zone to be available to be drawn after a read operation.

To establish the dimensions of the quiet zone, use McodeGetResult...() with M_QUIET_ZONE_TOP... and M_QUIET_ZONE_BOTTOM.... The bounding box only contains the part of the code that was processed in the read or grading operation.

(summarize)
ResultIndex

Specifies from which code occurrence or scan reflectance profile to get and draw results.

This parameter should be set to one of the following values:

function map For specifying the occurrence index of the code result
CollapseValue Description
Collapse M_DEFAULT

Same as M_ALL.

Collapse M_ALL +

Performs the specified operation for all code occurrences in the code result buffer.

Collapse OccurrenceIndex +

Specifies the index of the code occurrence in the code result buffer.

The value must be between 0 and the number of code model occurrences in the image buffer - 1. You can establish the number of code model occurrences using McodeGetResult() with M_NUMBER.

After a grading operation, the results stored in the result buffer are indexed starting at 0. See the Retrieving results section of Chapter 12: Codes for more information on result indices. Note that the index of the code occurrence is not available after a read operation.

(summarize)
Combination constant that can be used alone or as combination constant for the values listed in For specifying the occurrence index of the code result.

You can use the following value on its own, or add it to the above-mentioned values, to specify the scan reflectance profile index.

This macro can be used without specifying the index of the code occurrence only when there is only a single code occurrence in the result buffer, or to specify a scan reflectance profile of the first code occurrence.

function map To specify the scan reflectance profile index
CollapseValue Description
Collapse

Specifies the scan reflectance profile for which to perform the specified operation.

(summarize)
Parameters

To specify the scan reflectance profile index. You can use any of the following values for any drawing operation, unless otherwise specified.

M_DEFAULT

Same as M_ALL.

You cannot specify M_DEFAULT when using M_DRAW_REFLECTANCE_PROFILE.

M_ALL

Specifies to perform the specified operation for all scan reflectance profiles of the specified code occurrence.

You cannot specify M_ALL when using M_DRAW_REFLECTANCE_PROFILE.

Specifying M_ALL is the same as not including M_GRADE_RESULT_INDEX().

Value

Specifies the scan reflectance profile from which to perform the specified operation. You can establish the number of code model occurrences using McodeGetResult() with M_NUMBER.

ControlFlag

Specifies the function's control flag. Reserved for future expansion. This parameter must be set to M_DEFAULT.

Compilation information
Header Include mil.h.
Library Use mil.lib; milcode.lib.
DLL Requires mil.dll; milcode.dll.
DEFAULT UNSIGNED PROC NONE DRAW CODE DRAW POSITION DRAW EXTENDED AREA DRAW REFLECTANCE PROFILE DRAW SCAN PROFILES 2D COMPONENT LINEAR COMPONENT DRAW BOX DRAW QUIET ZONE DEFAULT ALL DEFAULT ALL