Gnome::Gdk4::N-Rectangle

#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------

Description

A Gnome::Gdk4::N-Rectangle data type for representing rectangles.

Gnome::Gdk4::N-Rectangle is identical to Cairo::cairo_rectangle_t. Together with Cairo’s Cairo::cairo_region_t data type, these are the central types for representing sets of pixels.

The intersection of two rectangles can be computed with .intersect(); to find the union of two rectangles use .union().

The Cairo::cairo_region_t 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.

#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------

Class initialization

new

:native-object

Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object() :$native-object! )

#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------

Methods

#-------------------------------------------------------------------------------

contains-point

Returns True if $rect contains the point described by $x and $y.

method contains-point ( Int() $x, Int() $y --> Bool )
  • $x; X coordinate.

  • $y; Y coordinate.

Return value; True if $rect contains the point.

#-------------------------------------------------------------------------------

equal

Checks if the two given rectangles are equal.

method equal ( N-Object $rect2 --> Bool )
  • $rect2; a Gnome::Gdk4::N-Rectangle

Return value; True if the rectangles are equal..

#-------------------------------------------------------------------------------

intersect

Calculates the intersection of two rectangles.

It is allowed for $dest to be the same as either $src1 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 undefined for $dest.

method intersect ( N-Object $src2, N-Object $dest --> Bool )
  • $src2; a Gnome::Gdk4::N-Rectangle

  • $dest; return location for the intersection of $src1 and $src2

Return value; True if the rectangles intersect..

#-------------------------------------------------------------------------------

union

Calculates the union of two rectangles.

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

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

method union ( N-Object $src2, N-Object $dest )
  • $src2; a Gnome::Gdk4::N-Rectangle

  • $dest; return location for the union of $src1 and $src2

Gnome::Gdk4 v0.1.23

Authors

  • Marcel Timmerman

License

Artistic-2.0

Dependencies

Gnome::Gio:api<2>Gnome::GObject:api<2>Gnome::Glib:api<2>Gnome::N:api<2>

Test Dependencies

Provides

  • Gnome::Gdk4::ContentProvider
  • Gnome::Gdk4::Display
  • Gnome::Gdk4::Drag
  • Gnome::Gdk4::Drop
  • Gnome::Gdk4::MemoryTexture
  • Gnome::Gdk4::N-ContentFormats
  • Gnome::Gdk4::N-ContentFormatsBuilder
  • Gnome::Gdk4::N-FileList
  • Gnome::Gdk4::N-RGBA
  • Gnome::Gdk4::N-Rectangle
  • Gnome::Gdk4::R-Paintable
  • Gnome::Gdk4::Snapshot
  • Gnome::Gdk4::Surface
  • Gnome::Gdk4::T-contentformats
  • Gnome::Gdk4::T-drag
  • Gnome::Gdk4::T-enums
  • Gnome::Gdk4::T-keysyms
  • Gnome::Gdk4::T-paintable
  • Gnome::Gdk4::T-rgba
  • Gnome::Gdk4::T-texture
  • Gnome::Gdk4::T-types
  • Gnome::Gdk4::Texture

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.