CImageView:Undo


The Undo method restores a member of the CImageSet displayed in the current CImageView window by replacing it with its undo copy. The target image may be the current displayed image or the CImageSet member at a specific index.

Syntax

bResult = CImageView:Undo()

bResult = CImageView:Undo( nIndex )

bullet.gif    nIndex is the index of the target image in the CImageSet, in the range range 1 to Count. If not specified, then the current image is used.

bullet.gif    On success, this method returns true.

bullet.gif    On failure, this method returns false.

Remarks

This method restores the target image in the CImageView window to its saved state. The target image must have beed saved either by calling the SaveUndoAll method or by calling SaveUndo for one or more of the images.

Example

Assume that a CImageView exists and is assigned toV. The following script saves an undo copy, changes the image, then restores it:

V = new_imageview()

-- create a CImageView object

I = new_image()

-- create a CImage

local sPath, bOk = GetFileName()

-- use the Open dialog to get a filename

I:Open(sPath)

-- load the image

V:Display(I)

-- display the image in the CImageView

bOk = V:SaveUndo()

-- save an undo copy of the image

I:Add(30.5)

-- add 30.5 to all pixel values.

V:Undo()

-- restore the image to its state before adding 30.5.

Related Topics

CImageView, SaveUndo, SaveUndoAll, UndoAll, Display, CImage class


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.