CRect:Set


The Set method initializes the 4 properties of the CRect to specific values.

Syntax

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

CRect:Set( CRect2 )

CRect:Set( CImage )

CRect:Set( CPoint )

CRect:Set( table )

where

    minx, maxx, miny, maxy are numbers that specify the rectangle limits in terms of pixel coordinates. They may be positive or negative.

    CRect2 is a CRect object which is copied to the properties of the current rectangle.

    CImage is a CImage object whose column and row dimensions are copied to the rectangle. Then the current rectangle extends from 1 to CImage:Cols(), and 1 to CImage:Rows().

    CPoint coordinates are assigned to the width and height so that the rectangle extends from 1 to CPoint.x and 1 to CPoint.y.

    table must contain numbers in elements [1] through [4]. Thes are assigned in order to the rectangle properties xmin, xmax, ymin, and ymax.

Example

The following script initializes the 4 dimensions of the CRect to xmin=100, xmax=200, ymin=40.5, ymax=300.25. Note the order in which the values are passed, with both x values first, followed by both y values:

R = NewRect()

-- create a CRect object

  --

-- do other operations

R:Set(100,200,40.5,300.25)

-- set the CRect to new values

Related Topics

SetToImage

Get

CRect class

Image Coordinate System

Subpixel Coordinate Definition