CRect:RectInside CRect:Set

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.

Syntax

CRect:Round()

bullet.gif    This method has no arguments and no return value.

Example

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.

I = V:GetImage()

-- create a CImage for the displayed image

R = V:GetCursorRect()

-- Create a CRect for the cursor rectangle

Printf("%lg %lg %lg %lg", R:Get() )

-- result: 383.43 502.14 603.43 554.83

R:Round()

-- round down to integer values

Printf("%lg %lg %lg %lg", R:Get() )

-- result: 383 502 603 555

Related Topics

CRect class, Floor, Get


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