An area is a rectangular set of pixels. areas are used by graphical objects and windows to represent their position and size.
An area has an origin, described by the area<->x
and area<->y
attributes and a size described by the area<->width
and area<->height
attributes. All parameters are in pixel-units. An area with either area<->width
or area<->height
equal to 0 (zero) contains no pixels.
The position of the origin with respect to the rectangle is
determined by the sign of the width and height attributes. See area area->orientation
and area area->normalise.
Class area supports
class graphical to
represent the area of the graphical in the coordinate system of its
device. Most of the methods defined on class area
also exist on class graphical.
For area's, these methods are side-effect free, whereas for graphicals
they change the geometry of the graphical. See graphical->set
and‘graphical
area->geometry’.
<-x
and area<-y
of the area such that the area<-center of
the area matches the argument point.
->set:
0, 0, 0, 0. Note that an area with area<-width
or
area<-height
equal contain no pixels and area->union
with such an area is a no-op.
<-width
and area<-height
such that area<-corner
matches the argument point. Its graphical->corner
counterpart is sometimes used to implement resizing.
->normalise),
this implies:
<-width := <-width - 2*<arg> <-x := <-x + <arg>
and similar for area<-y
and area<-height.
Deals properly with non-normalised areas.
->normalise.->inside->decrease.
->in,
graphical->in_event_area
and area->overlap.
->inside
both area's. To get the intersection without modifying either of the
areas, use
area<-intersection.
Fails without modifying the area if the areas do not
area->overlap.
->orientation:
north_west.
<-x, area<-y, area<-width
and area<-height.
The point (area<-x, area<-y)
is called the origin or area<-position.
Either or both
area<-width
and area<-height
(together representing area<-size)
may be negative. This method manipulates one or both of the pairs area<-x/area<-width
or
area<-y/area<-height
such that the origin becomes the indicated corner.
The call area->orientation:
north_west is equivalent to area->normalise.
area ->orientationarea ->widtharea ->heightnorth_west >= 0 >= 0 south_west >= 0 < 0 north_east < 0 >= 0 south_east < 0 < 0
<-distance
returns 0 and area->intersection
computes the common pixels.
<-x
and area<-y
from the corresponding values of the point
object.<-x
:= area<-x
+ point<-x
and area<-y
:= area<-y
+ point<-y.<-x, area<-y, area<-width
and area<-height
from the 4 integer arguments. Any argument that is @default
will not cause the corresponding parameter to be changed.->width
and area->height
from the corresponding size parameters.<-union
computes the same without changing either of the area
objects.
<-orientation.
<-x
+ area<-width, area<-y
+ area<-height
<-orientation
of the new area is the same as that of the receiver.
See also area->intersection
and area<-union.
Diagnostics: Fails if the areas do not area->overlap.
->same_sides, but returns those sides
for which the value in the receiver is closer to the origin (i.e. less)
then for the argument area.
<-same_sides,
but accepts sides to be the same when they are within the specified
distance. With distance 0, exactly the same as
area<-same_sides.
<-orientation
= north_west.
->orientation
for details.
Inherits description from: area->orientation
<-x
and area<-y.
Receiver Argument Value (octal) top top 01 top center 02 top bottom 04 center top 010 bottom top 020 bottom center 040 bottom bottom 0100 left left 0200 left middle 0400 left right 01000 middle left 02000 middle middle 04000 middle right 010000 right left 020000 right middle 040000 right right 0100000
The PCE/Prolog library file area.pl
defines these bitmasks.
<-width
and area<-height
of the area. Note that either or both may be negative. See area->orientation.