new_rect


The new_rect function is a non-class version of the CRect:new method which creates and returns a new CRect object.

Syntax

R = new_rect()

bullet.gif    Creates a default CRect object with properties initialized to the default values 0,0,0,0.

R = new_rect( CRect2 )

bullet.gif    This is a copy constructor. It creates a new CRect object initialized to the properties of the CRect2 argument.

R = new_rect( xmin, xmax, ymin, ymax )

bullet.gif    Creates a CRect object initialized to xmin, xmax, ymin, ymax.

R = CRect:Set( xmin, xmax, ymin, ymax )

bullet.gif    Creates a new CRect object with properties set to the numbers nXmin, nXmax, nYmin, and nYmax. The values may be positive or negative. If the rectangle will involve working with images or arrays, then the values of nXmin and nXmax should usually be 1.

R = new_rect( CImage )

bullet.gif    Creates a new CRect object initialized to the column and row dimensions of a CImage. The rectangle will extend from 1 to CImage:Cols(), and 1 to CImage:Rows().

R = new_rect( table )

bullet.gif    Creates a new CRect object from the first 4 values in a 1-dimensional array, in particular, the values of table[1] through table[4]. These numbers are assigned in order to the rectangle properties xmin, xmax, ymin, and ymax.

bullet.gif    R is returned as the new CRect object.

bullet.gif    On Failure, nil is returned.

Example

The following script creates a CHistogram object and uses it to calculate a histogram of data.

R = new_rect(1,19,420,600)

-- create a rectangle object

 

-- other uses of the class go here

R:delete()

-- clean up memory when done

Related Topics

CRect class, new, delete


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