Reference

Rectangle(3poc)

Portable Object Compiler Rectangle class

NAME

Rectangle - Portable Object Compiler Rectangle class

Rectangle

Inherits from:

Object

Class Description

Rectangle instances are pairs of Point objects. It is mostly Squeak and Stepstone ICpak101 compatible.

Method types

Creation

* new
* origin:corner:
* origin:extent:
* origin::corner::
* origin::extent::
* free

Motion

* origin:
* corner:
* origin:corner:
* extent::
* extent:
* origin::
* corner::

Comparing

* contains:
* hash
* isEqual:

Interrogation

* left
* right
* top
* bottom
* width
* height
* origin
* topLeft
* topRight
* topCenter
* corner
* bottomLeft
* bottomCenter
* bottomRight
* center
* leftCenter
* rightCenter
* extent
* quickMerge:

Arithmetic

* moveBy:
* translateBy:
* align:with:

Printing

* printOn:

Methods

new

+ new

Returns a new rectangle with origin and corner at (0,0).

origin:corner:

+ origin : p corner : q

Returns a new rectangle with origin and corner set to p and q .

origin:extent:

+ origin : p extent : q

origin::corner::

+ origin :(int) x1 :(int) y1 corner :(int) x2 :(int) y2

origin::extent::

+ origin :(int) x :(int) y extent :(int) w :(int) h

free

- free

Frees the origin and corner of the Point too.

origin:

- origin : p

corner:

- corner : q

origin:corner:

- origin : p corner : q

Sets origin and corner to p and q .

extent::

- extent :(int) w :(int) h

extent:

- extent : q

origin::

- origin :(int) x1 :(int) y1

corner::

- corner :(int) x1 :(int) y1

contains:

- ( BOOL ) contains : aPoint

Yes if inside, or on a border of, the rectangle.

hash

- ( unsigned ) hash

isEqual:

- ( BOOL ) isEqual : aRectangle

Returns YES if aRectangle is some kind of rectangle, and if corner and origin are equal.

left

- ( int ) left

right

- ( int ) right

top

- ( int ) top

bottom

- ( int ) bottom

width

- ( int ) width

height

- ( int ) height

origin

- origin

topLeft

- topLeft

Same as origin .

topRight

- topRight

Answer the point at the top right corner of the receiver's top horizontal.

topCenter

- topCenter

Answer the point at the center of the receiver's top horizontal.

corner

- corner

bottomLeft

- bottomLeft

Returns the point at the left edge of the bottom horizontal line of the receiver(or bottomLeft for short).

bottomCenter

- bottomCenter

Answer the point at the center of the receiver's bottom horizontal.

bottomRight

- bottomRight

Same as corner .

center

- center

Return the point at the center of the receiver.

leftCenter

- leftCenter

Return the point at the center of the receiver's left vertical line.

rightCenter

- rightCenter

Return the point at the center of the receiver's left vertical line.

extent

- extent

Return a new Point, set to the width and height of the rectangle.

quickMerge:

- quickMerge : rect

Return the receiver if it encloses the given rectangle or the merge of the two rectangles if it doesn't. This method is an optimization to reduce extra rectangle creations.

moveBy:

- moveBy : aPoint

translateBy:

- translateBy : p

This method is like moveBy: , but returns a new rectangle instead of modifying the receiver.

align:with:

- align : p1 with : p2

Answer a rectangle that is translated by p2 - p1 .

printOn:

- printOn :(IOD) aFile