3.12 <GdkRectangle>

Structure: <GdkRectangle>

Represents a rectangle.

<GdkRectangle> is identical to <CairoRectangle>. Together with Cairo’s <CairoRegion> data type, these are the central types for representing sets of pixels.

The intersection of two rectangles can be computed with rectangle:intersect!; to find the union of two rectangles use rectangle:union!.

The <CairoRegion> type provided by Cairo is usually used for managing non-rectangular clipping of graphical operations.

The Graphene library has a number of other data types for regions and volumes in 2D and 3D.

Fields

x

the x coordinate of the top left corner

y

the y coordinate of the top left corner

width

the width of the rectangle

height

the height of the rectangle

Procedures

Method: rectangle:contains-point? self x y ⇒ %return
Method: contains-point? self x y ⇒ %return

Returns #t if self contains the point described by x and y.

self

Passed: a <GdkRectangle>.

a <GdkRectangle>

x

Passed: a 32-bit integer.

X coordinate

y

Passed: a 32-bit integer.

Y coordinate

%return

Returned: a boolean.

#t if self contains the point

Method: rectangle:equal? self rect2 ⇒ %return
Method: equal? self rect2 ⇒ %return

Checks if the two given rectangles are equal.

self

Passed: a <GdkRectangle>.

a <GdkRectangle>

rect2

Passed: a <GdkRectangle>.

a <GdkRectangle>

%return

Returned: a boolean.

#t if the rectangles are equal.

Method: rectangle:intersect! self src2 dest ⇒ %return dest
Method: intersect! self src2 dest ⇒ %return dest

Calculates the intersection of two rectangles.

It is allowed for dest to be the same as either self or src2. If the rectangles do not intersect, dest’s width and height is set to 0 and its x and y values are undefined. If you are only interested in whether the rectangles intersect, but not in the intersecting area itself, pass #f for dest.

self

Passed: a <GdkRectangle>.

a <GdkRectangle>

src2

Passed: a <GdkRectangle>.

a <GdkRectangle>

dest

Passed, filled in, and returned: a <GdkRectangle>.

return location for the intersection of self and src2

%return

Returned: a boolean.

#t if the rectangles intersect.

Method: rectangle:union! self src2 dest ⇒ dest
Method: union! self src2 dest ⇒ dest

Calculates the union of two rectangles.

The union of rectangles self and src2 is the smallest rectangle which includes both self and src2 within it. It is allowed for dest to be the same as either self or src2.

Note that this function does not ignore ’empty’ rectangles (ie. with zero width or height).

self

Passed: a <GdkRectangle>.

a <GdkRectangle>

src2

Passed: a <GdkRectangle>.

a <GdkRectangle>

dest

Passed, filled in, and returned: a <GdkRectangle>.

return location for the union of self and src2