CImage:new
The new method constructs a new instance of a CImage object. Four constructors are available.
CImage = CImage:new()
CImage = CImage:new( CImage2 )
|
CImage = CImage:new( nCols, sDataType ) |
|
CImage = CImage:new( nCols, nRows, sDataType ) |
|
Four overloads are provided for constructing a new CImage object; they create an empty CImage, a copy of an existing CImage, or a CImage of specified size and data type. If you pass something other than the options described above, an empty CImage is returned. Before using an empty CImage, you must use Create, Open, Copy, or CImageView:Attach or a related method to assign aimage data to it.
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:
|
-- create a new CImage object |
|
-- load an image from a file |
|
-- create a new CImage with a copy of A |
|
-- print the name of image A |
|
-- print the name of image B. Same as A |
|
-- delete when done |
|
-- delete when done |