SetPixel Method

NI Vision for Visual Basic

SetPixel Method

Syntax

CWIMAQVision.SetPixel DestImage, Point, PixelValueOrReal [, Imaginary = 0]

Return Type

Long

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

Purpose

Obsolete—Use SetPixel2 instead. Changes a pixel value in an image.

Remarks

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

Parameters

DestImage As CWIMAQImage

The image whose pixel value the method sets.

Point As CWIMAQPoint

The coordinate of the pixel to set.

PixelValueOrReal As Single

The pixel replacement value. If the image is Complex, this parameter sets the real part of the pixel replacement value.

Imaginary As Variant

[Optional] If the image is Complex, this parameter sets the imaginary part of the pixel replacement value.

This parameter has a default value of 0.

Example

Private Sub Run_Click()
    Dim point As New CWIMAQPoint
    Dim value
    
    ' Initialize the point alpha planes
    point.Initialize 10, 10
    
    ' Get the pixel from the image in Viewer1
    CWIMAQVision1.GetPixel CWIMAQViewer1.Image, point, value
    
    ' Set the pixel value at a different location
    ' into the image in Viewer1.
    point.Initialize 40, 40
    CWIMAQVision1.SetPixel CWIMAQViewer1.Image, point, value
End Sub

See Also

SetPixel2