RectangleProtocol

public protocol RectangleProtocol

The PangoRectangle structure represents a rectangle.

PangoRectangle is frequently used to represent the logical or ink extents of a single glyph or section of text. (See, for instance, [methodPango.Font.get_glyph_extents].)

The RectangleProtocol protocol exposes the methods and properties of an underlying PangoRectangle 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.

  • ptr

    Untyped pointer to the underlying PangoRectangle instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • _ptr Default implementation

    Typed pointer to the underlying PangoRectangle instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the PangoRectangle instance.

    Declaration

    Swift

    var _ptr: UnsafeMutablePointer<PangoRectangle>! { get }
  • Required Initialiser for types conforming to RectangleProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

Rectangle Record: RectangleProtocol extension (methods and fields)

  • attrShapeNew(logicalRect:) Extension method

    Create a new shape attribute.

    A shape is used to impose a particular ink and logical rectangle on the result of shaping a particular glyph. This might be used, for instance, for embedding a picture or a widget inside a PangoLayout.

    Declaration

    Swift

    @inlinable
    func attrShapeNew<RectangleT>(logicalRect: RectangleT) -> Pango.AttributeRef! where RectangleT : RectangleProtocol
  • Creates a new shape attribute.

    Like [funcPango.AttrShape.new], but a user data pointer is also provided; this pointer can be accessed when later rendering the glyph.

    Declaration

    Swift

    @inlinable
    func attrShapeNewWithData<RectangleT>(logicalRect: RectangleT, data: gpointer? = nil, copyFunc: PangoAttrDataCopyFunc? = nil, destroyFunc: GDestroyNotify? = nil) -> Pango.AttributeRef! where RectangleT : RectangleProtocol
  • extentsToPixels(nearest:) Extension method

    Converts extents from Pango units to device units.

    The conversion is done by dividing by the PANGO_SCALE factor and performing rounding.

    The inclusive rectangle is converted by flooring the x/y coordinates and extending width/height, such that the final rectangle completely includes the original rectangle.

    The nearest rectangle is converted by rounding the coordinates of the rectangle to the nearest device unit (pixel).

    The rule to which argument to use is: if you want the resulting device-space rectangle to completely contain the original rectangle, pass it in as inclusive. If you want two touching-but-not-overlapping rectangles stay touching-but-not-overlapping after rounding to device units, pass them in as nearest.

    Declaration

    Swift

    @inlinable
    func extentsToPixels(nearest: RectangleRef? = nil)
  • extentsToPixels(nearest:) Extension method

    Converts extents from Pango units to device units.

    The conversion is done by dividing by the PANGO_SCALE factor and performing rounding.

    The inclusive rectangle is converted by flooring the x/y coordinates and extending width/height, such that the final rectangle completely includes the original rectangle.

    The nearest rectangle is converted by rounding the coordinates of the rectangle to the nearest device unit (pixel).

    The rule to which argument to use is: if you want the resulting device-space rectangle to completely contain the original rectangle, pass it in as inclusive. If you want two touching-but-not-overlapping rectangles stay touching-but-not-overlapping after rounding to device units, pass them in as nearest.

    Declaration

    Swift

    @inlinable
    func extentsToPixels<RectangleT>(nearest: RectangleT?) where RectangleT : RectangleProtocol
  • x Extension method

    X coordinate of the left side of the rectangle.

    Declaration

    Swift

    @inlinable
    var x: gint { get set }
  • y Extension method

    Y coordinate of the the top side of the rectangle.

    Declaration

    Swift

    @inlinable
    var y: gint { get set }
  • width Extension method

    width of the rectangle.

    Declaration

    Swift

    @inlinable
    var width: gint { get set }
  • height Extension method

    height of the rectangle.

    Declaration

    Swift

    @inlinable
    var height: gint { get set }