CImage:Sqrt


The Sqrt method computes the square root of the pixel values. The result replaces the image.

Syntax

bSuccess = CImage:Sqrt()

where

    bSuccess is the returned success code. On success it is true, otherwise false.

  

This method has a possibility of an illegal operation, "square root of a negative number", if a negative valued pixel is encountered. Mira traps this condition and substitutes a replacement value into the output pixel. The replacement value is set for math operations using the SetMathErrVal method.

Example

Suppose an image is displayed in a CImageView named V. The following script computes the square root of the image values and redisplays the result:

I = V:GetImage()

-- attach the current displayed image

I:Sqrt()

-- perform the operation

V:Update()

-- update the display after the shift

Related Topics

Pow

CImage class