Shift Method

NI Vision for Visual Basic

Shift Method

Syntax

CWIMAQVision.Shift SourceImage, DestImage [, XOffset = 0] [, YOffset = 0] [, FillValue = 0]

Return Type

Long

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

Purpose

Translates an image based on a horizontal and vertical offset.

Remarks

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

Parameters

SourceImage As CWIMAQImage

The image to shift.

DestImage As CWIMAQImage

The resulting image.

XOffset As Variant

[Optional] Specifies how many pixels to the right to shift the image.

This parameter has a default value of 0.

YOffset As Variant

[Optional] Specifies how many pixels down to shift the image.

This parameter has a default value of 0.

FillValue As Variant

[Optional] The value with which to fill the uncovered image pixels.

This parameter has a default value of 0.

Example

Private Sub Run_Click()
    Dim i As New CWIMAQImage
    
    ' Shift the image in Viewer1 10 pixels to the right and 20 pixels down.
    ' Store the results in i.
    CWIMAQVision1.Shift CWIMAQViewer1.Image, i, 10, 20, 128
End Sub