CImage:Close


The Close method deletes the image opened or created by the CImage class and frees all associated memory.

Syntax

bResult = CImage:Close()

bullet.gif    On success, this method returns true.

bullet.gif    On failure, this method returns false.

Remarks

The Close method need not be called if the destructor delete is called; however, calling Close retains the CImage object while freeing the image from memory. Typically you use new to create a CImage object, then use Open and Close to load and unload images many times before eventually calling delete to remove the CImage from memory.

Example

Suppose an image file exists with a full path named sPath. The script below shows the image being opened and then closed:

I = new_image()

-- create a CImage object

bOk = I:Open(sPath)

-- open the image from path sPath.

if not bOk then

-- if not opened, then...

  Exit()

-- leave the script, etc.

end

-- close the if block.

  ...

-- do something

I:Close()

-- remove the image from memory

I:delete()

-- if not getting another image, then delete the object.

Related Topics

CImage class, CImageView, Open

 


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