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.
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.
Suppose an image file exists with a full path named sPath. The script below shows the image being opened and copied:
|
-- create a CImage object |
|
-- open the image from path sPath. |
|
-- if not opened, then exist the script |
|
-- create a new CImage object |
|
-- copy Iold into Inew |
-- |
-- do something |