CImage:new


The new method constructs a new instance of a CImage object. You must call new before using any class methods or properties. After creating a new image, you must use the Create, Open, or Copy method from the CImage class or attach it from the CImageView class. Note that the object can also be created using new_image.

Syntax

CImage = CImage:new()

bullet.gif    Creates a new CImage.

CImage = CImage:new( CImage_old )

bullet.gif    This is a copy constructor. It creates a new CImage initialized to the properties of CImage_old.

Example

The following script 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 class, Copy, Ceate, delete, Math Operators, new_image


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