gi-gdk4-4.0.10: Gdk bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gdk.Structs.Rectangle

Contents

- Exported types
- Methods
  - containsPoint
  - equal
  - intersect
  - union
- Properties
  - height
  - width
  - x
  - y

Description

Represents a rectangle.

`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 `rectangleIntersect`; to find the union of two rectangles use `rectangleUnion`.

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.

Synopsis

- newtype Rectangle = Rectangle (ManagedPtr Rectangle)
- newZeroRectangle :: MonadIO m => m Rectangle
- rectangleContainsPoint :: (HasCallStack, MonadIO m) => Rectangle -> Int32 -> Int32 -> m Bool
- rectangleEqual :: (HasCallStack, MonadIO m) => Rectangle -> Rectangle -> m Bool
- rectangleIntersect :: (HasCallStack, MonadIO m) => Rectangle -> Rectangle -> m (Bool, Rectangle)
- rectangleUnion :: (HasCallStack, MonadIO m) => Rectangle -> Rectangle -> m Rectangle
- getRectangleHeight :: MonadIO m => Rectangle -> m Int32
- setRectangleHeight :: MonadIO m => Rectangle -> Int32 -> m ()
- getRectangleWidth :: MonadIO m => Rectangle -> m Int32
- setRectangleWidth :: MonadIO m => Rectangle -> Int32 -> m ()
- getRectangleX :: MonadIO m => Rectangle -> m Int32
- setRectangleX :: MonadIO m => Rectangle -> Int32 -> m ()
- getRectangleY :: MonadIO m => Rectangle -> m Int32
- setRectangleY :: MonadIO m => Rectangle -> Int32 -> m ()

# Exported types

newtype Rectangle Source #

Memory-managed wrapper type.

Constructors

Rectangle (ManagedPtr Rectangle) |

#### Instances

Instances details

Eq Rectangle Source # |
Instance details Defined in GI.Gdk.Structs.Rectangle Methods (==) :: Rectangle -> Rectangle -> Bool Source # (/=) :: Rectangle -> Rectangle -> Bool Source #
GBoxed Rectangle Source # |
Instance details Defined in GI.Gdk.Structs.Rectangle
ManagedPtrNewtype Rectangle Source # |
Instance details Defined in GI.Gdk.Structs.Rectangle Methods toManagedPtr :: Rectangle -> ManagedPtr Rectangle Source #
TypedObject Rectangle Source # |
Instance details Defined in GI.Gdk.Structs.Rectangle Methods glibType :: IO GType Source #
HasParentTypes Rectangle Source # |
Instance details Defined in GI.Gdk.Structs.Rectangle
tag ~ 'AttrSet => Constructible Rectangle tag Source # |
Instance details Defined in GI.Gdk.Structs.Rectangle Methods new :: MonadIO m => (ManagedPtr Rectangle -> Rectangle) -> [AttrOp Rectangle tag] -> m Rectangle Source #
IsGValue (Maybe Rectangle) Source # | Convert `Rectangle` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gdk.Structs.Rectangle Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Rectangle -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Rectangle) Source #
type ParentTypes Rectangle Source # |
Instance details Defined in GI.Gdk.Structs.Rectangle type ParentTypes Rectangle = '[] :: [Type]

newZeroRectangle :: MonadIO m => m Rectangle Source #

Construct a `Rectangle` struct initialized to zero.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

containsPoint, equal, intersect, union.

#### Getters

None.

#### Setters

None.

## containsPoint

rectangleContainsPoint Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Rectangle | `rect`: a `GdkRectangle`
-> Int32 | `x`: X coordinate
-> Int32 | `y`: Y coordinate
-> m Bool | Returns: `True` if `rect` contains the point

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

## equal

rectangleEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Rectangle | `rect1`: a `GdkRectangle`
-> Rectangle | `rect2`: a `GdkRectangle`
-> m Bool | Returns: `True` if the rectangles are equal.

Checks if the two given rectangles are equal.

## intersect

rectangleIntersect Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Rectangle | `src1`: a `GdkRectangle`
-> Rectangle | `src2`: a `GdkRectangle`
-> m (Bool, Rectangle) | Returns: `True` if the rectangles 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 `Nothing` for `dest`.

## union

rectangleUnion Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Rectangle | `src1`: a `GdkRectangle`
-> Rectangle | `src2`: a `GdkRectangle`
-> m Rectangle |

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).

# Properties

## height

the height of the rectangle

getRectangleHeight :: MonadIO m => Rectangle -> m Int32 Source #

Get the value of the “`height`” field. When overloading is enabled, this is equivalent to

    get rectangle #height

setRectangleHeight :: MonadIO m => Rectangle -> Int32 -> m () Source #

Set the value of the “`height`” field. When overloading is enabled, this is equivalent to

    set rectangle [ #height := value ]

## width

the width of the rectangle

getRectangleWidth :: MonadIO m => Rectangle -> m Int32 Source #

Get the value of the “`width`” field. When overloading is enabled, this is equivalent to

    get rectangle #width

setRectangleWidth :: MonadIO m => Rectangle -> Int32 -> m () Source #

Set the value of the “`width`” field. When overloading is enabled, this is equivalent to

    set rectangle [ #width := value ]

## x

the x coordinate of the top left corner

getRectangleX :: MonadIO m => Rectangle -> m Int32 Source #

Get the value of the “`x`” field. When overloading is enabled, this is equivalent to

    get rectangle #x

setRectangleX :: MonadIO m => Rectangle -> Int32 -> m () Source #

Set the value of the “`x`” field. When overloading is enabled, this is equivalent to

    set rectangle [ #x := value ]

## y

the y coordinate of the top left corner

getRectangleY :: MonadIO m => Rectangle -> m Int32 Source #

Get the value of the “`y`” field. When overloading is enabled, this is equivalent to

    get rectangle #y

setRectangleY :: MonadIO m => Rectangle -> Int32 -> m () Source #

Set the value of the “`y`” field. When overloading is enabled, this is equivalent to

    set rectangle [ #y := value ]