CImage:Copy


The Copy method makes a copy of the CImage object, including its encapsulated image. Therefore the CImage should be terminated using Close or delete when you are done using it.

Syntax

CImage = CImage:Copy()

bullet.gif    On success, this method returns a new CImage object containing an independent copy of the image. In place of CImage, use the name of the actual object to be copied (see Example).

bullet.gif    On failure, this method returns nil.

Example

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

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

-- end of if block

I2 = I:Copy()

-- create a new CImage named I2

  ...

-- do something

I:delete()

-- when done with I, remove it from memory

I2:delete()

-- when done with I2, remove it from memory

Related Topics

CImage class, Open, Close


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