CRect:delete CRect:Get

CRect:Floor


The Floor method truncates all 4 rectangle limits to the next lower integer value. For example xmax=100.54 becomes xmax=100.

Syntax

CRect:Floor()

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

Remarks

This method truncates all 4 rectangle limits to integer values. One common use of this method is when using the rectangle to refer to image pixels. The value of the image pixel is effective at its center, which occurs at an exact integer coordinate. In some analyses, it is critical that the value used for the pixel be applied exactly at its center pixel coordinates, and this method helps with that requirement.

Example

The following script returns the values of the image cursor rectangle and changes them to integer values using the Floor method. 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:Floor()

-- round down to integer values

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

-- result: 383 502 603 554

Related Topics

CRect class, Round, Get


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