CRect:new
The new method constructs a new instance of a CRect object. The CRect class includes 4 properties that describe the minimum and maximum x values and the minimum and maximum y values. You can treat this object as a classic rectangle or you can use it simply to hold 4 numbers Note that the object can also be created using new_rect.
R = CRect:new()
R = CRect:new( CRect2 )
R = CRect:new( xmin, xmax, ymin, ymax )
R = CRect:Set( xmin, xmax, ymin, ymax )
R = CRect:new( CImage )
R = CRect:new( table )
|
These different constructors are provided to greatly expand the versatility of the CRect class. Also, since the contructor returns the new CRect, the constructor is useful in an expression, like I:SetRegionVal( t, CRect:new(Point) ).
The following script illustrates using the 3 constructors. All produce the same result:
|
-- create CRect A and set values |
|
-- result: 100:300, 400:800 |
|
|
|
-- copy A to a new CRect B |
|
-- result: 100:300, 400:800 |
|
|
|
-- create a default CRect C |
|
|
|
-- result: 100:300, 400:800 |
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.