RectangleProtocol
public protocol RectangleProtocol
The RectangleProtocol protocol exposes the methods and properties of an underlying GdkRectangle instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Rectangle.
Alternatively, use RectangleRef as a lighweight, unowned reference if you already have an instance you just want to use.
A GdkRectangle data type for representing rectangles.
GdkRectangle is identical to cairo_rectangle_t. Together with Cairo’s
cairo_region_t data type, these are the central types for representing
sets of pixels.
The intersection of two rectangles can be computed with
[methodGdk.Rectangle.intersect]; to find the union of two rectangles use
[methodGdk.Rectangle.union].
The 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.
-
Untyped pointer to the underlying
GdkRectangleinstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
rectangle_ptrDefault implementationTyped pointer to the underlying
GdkRectangleinstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkRectangleinstance.Declaration
Swift
var rectangle_ptr: UnsafeMutablePointer<GdkRectangle>! { get } -
Required Initialiser for types conforming to
RectangleProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
containsPoint(x:Extension methody: ) Declaration
Swift
@inlinable func containsPoint(x: Int, y: Int) -> Bool -
equal(rect2:Extension method) Checks if the two given rectangles are equal.
Declaration
Swift
@inlinable func equal<RectangleT>(rect2: RectangleT) -> Bool where RectangleT : RectangleProtocol -
intersect(src2:Extension methoddest: ) Calculates the intersection of two rectangles.
It is allowed for
destto be the same as eithersrc1orsrc2. 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, passnilfordest.Declaration
Swift
@inlinable func intersect<RectangleT>(src2: RectangleT, dest: RectangleT?) -> Bool where RectangleT : RectangleProtocol -
union(src2:Extension methoddest: ) Calculates the union of two rectangles.
The union of rectangles
src1andsrc2is the smallest rectangle which includes bothsrc1andsrc2within it. It is allowed fordestto be the same as eithersrc1orsrc2.Note that this function does not ignore ‘empty’ rectangles (ie. with zero width or height).
Declaration
Swift
@inlinable func union<RectangleT>(src2: RectangleT, dest: RectangleT) where RectangleT : RectangleProtocol -
cairoRectangle(cr:Extension method) Adds the given rectangle to the current path of
cr.Declaration
Swift
@inlinable func cairoRectangle<ContextT>(cr: ContextT) where ContextT : ContextProtocol -
xExtension methodthe x coordinate of the top left corner
Declaration
Swift
@inlinable var x: gint { get set } -
yExtension methodthe y coordinate of the top left corner
Declaration
Swift
@inlinable var y: gint { get set } -
widthExtension methodthe width of the rectangle
Declaration
Swift
@inlinable var width: gint { get set } -
heightExtension methodthe height of the rectangle
Declaration
Swift
@inlinable var height: gint { get set }
View on GitHub
Install in Dash
RectangleProtocol Protocol Reference