CImage:Copy


The Copy method copies another object into the current CImage. To use this method, the current CImage object must already have been created using new or a similar method. The object to be copied may be another CImage, CArray, CMatrix, or a Lua table.

If, instead, you want to duplicate the current CImage object into a new CImage, use the Dup method instead.

Syntax

bSuccess = CImage:Copy( CImage2 )

bSuccess = CImage:Copy( CArray )

bSuccess = CImage:Copy( CMatrix )

bSuccess = CImage:Copy( table )

where

    table, CImage2, CArray, and CMatrix are the data to copy.

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

  

This method is similar to using the CImage:new constructor in its "copy contructor" mode except that it is used after the CImage has already been created. On success, this method replaces the current CImage object with a copy of the data object.

Example

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

Iold = CImage:new()

-- create a CImage object

bOk = Iold:Open(sPath)

-- open the image from path sPath.

if not bOk then Exit() end

-- if not opened, then exist the script

Inew = CImage:new()

-- create a new CImage object

bSuccess = Inew:Copy( Iold )

-- copy Iold into Inew

  --

-- do something

Related Topics

new

Dup

Open

Close

CImage class