Instant properties: area

The instant property area represents the area occupied by a rectangle with size determined either by a point operand or by a rect operand and is expressed in pixel.

Declaration

Form 1:

int32 rect.area

Form 2:

int32 point.area

Discussion

In its first form, the read access to this property results in the area occupied by the rectangle specified in the rect operand. The area is calculated by multiplying the width of the rectangle with its height. If the width, or the height are negative, the resulting area can become negative too. If the width or the height are zero, the area will also result in 0 (zero). Please note, this property is read-only. The write access to this property is not allowed. For example:

var rect r = <100,200,110,220>; // Calculate the area of the rectangle var int32 result = r.area; // result = 200 // Modification is not allowed r.area = 1200; // Chora compiler error

In its second form, the read access to this property results in the area occupied by a rectangle with width and height corresponding to the x and y instant properties of the point operand. If the width, or the height are negative, the resulting area can become negative too. If the width or the height are zero, the area will also result in 0 (zero). Please note, this property is read-only. The write access to this property is not allowed. For example:

var point p = <10,20>; // Calculate the area of the rectangle var int32 result = p.area; // result = 200 // Modification is not allowed p.area = 1200; // Chora compiler error