DrawRect2 Method

NI Vision for Visual Basic

DrawRect2 Method

Syntax

CWIMAQVision.DrawRect2 SourceImage, DestImage, Rectangle, DrawMode [, GrayLevel = 0]

Return Type

Long

On success, this method returns 0. On failure, this method returns a negative number.

Purpose

Draws a rectangle on an image.

Remarks

Use this method with U8, U16, I16, SGL, RGB32, and HSL32 images.

Parameters

SourceImage As CWIMAQImage

The input image.

DestImage As CWIMAQImage

The resulting image.

Rectangle As CWIMAQRectangle

Defines the rectangle to draw.

DrawMode As CWIMAQDrawModes

Defines how to draw the rectangle.

GrayLevel As Variant

[Optional] The pixel value that the method uses for drawing if you set DrawMode to cwimaqDrawModeFrame or cwimaqDrawModePaint.

This parameter has a default value of 0.

Example

Dim i As New CWIMAQImage
Dim r As New CWIMAQRectangle

' Draw a rectangle on the image in Viewer1.
' Store the result in i.
r.Initialize 10, 20, 50, 100
CWIMAQVision1.DrawRect2 CWIMAQViewer1.Image, i, r, _
                        cwimaqDrawModePaint, 128