CImage:delete

CImage:new


The new method constructs a new instance of a CImage object. Two constructor overloads are available.

Syntax

I = CImage:new()

    Creates a new CImage I with the image pointer initialized to nil.

I = CImage:new( CImage2 )

    This is a copy constructor. It creates a new CImage I initialized to a new copy of the image and data members of the CImage2 argument.

Remarks

Two overloads are provided for this method; they create a default CImage or a copy of an existing CImage object. If you pass something other than nil or a CImage—such as a string or a single number—this method returns the a default CImage.

Example

The following script fragment creates a CImage object and loads an image into it. Then it creates a new CImage that is a duplicate of the first one. This makes 2 images loaded into memory:

 

A = CImage:new()

-- create a new CImage object

A:Open( sPath )

-- load an image from a file

B = CImage:new( A )

-- create a new CImage with a copy of A

Printf("A name: %s\n", A:Path(60))

-- print the name of image A

Printf("B name: %s\n", B:Path(60))

-- print the name of image B. Same as A

A:delete()

-- delete when done

B:delete()

-- delete when done

Related Topics

CImage, Copy, delete