CRect:Round
The Round method rounds all 4 rectangle limits to the nearest integer value. For example xmax=100.54 becomes xmax=101 , and xmax=100.49 becomes xmax=100. This method uses the Round function.
CRect:Round() |
The following script returns the values of the image cursor rectangle and then rounds them to the nearest integer pixel coordinates. Assume that a CImageView V is attached to an image window. Note that the CImage I and CRect R do not need to be created separately, as they are created by the methods that return them as a value.
|
-- create a CImage for the displayed image |
|
-- Create a CRect for the cursor rectangle |
|
-- result: 383.43 502.14, 603.43 554.83 |
|
-- round to integer values |
|
-- result: 383 502, 603 555 |