CImage:Close
The Close method deletes the image opened or created by the CImage class and frees all associated memory.
bResult = CImage:Close() |
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.
Suppose an image file exists with a full path named sPath. The script fragment below shows the image being opened and then closed:
|
-- create a CImage object |
|
-- open the image from path sPath. |
|
-- if not opened, then... |
|
-- leave the script, etc. |
|
-- close the if block. |
|
-- do something |
|
-- remove the image from memory |
|
-- if not getting another image, then delete the object. |