| Copyright | Will Thompson and Iñaki García Etxebarria | 
|---|---|
| License | LGPL-2.1 | 
| Maintainer | Iñaki García Etxebarria | 
| Safe Haskell | Safe-Inferred | 
| Language | Haskell2010 | 
GI.Clutter.Structs.Rect
Description
The location and size of a rectangle.
The width and height of a Rect can be negative; Clutter considers
 a rectangle with an origin of [ 0.0, 0.0 ] and a size of [ 10.0, 10.0 ] to
 be equivalent to a rectangle with origin of [ 10.0, 10.0 ] and size of
 [ -10.0, -10.0 ].
Application code can normalize rectangles using rectNormalize:
 this function will ensure that the width and height of a Rect are
 positive values. All functions taking a Rect as an argument will
 implicitly normalize it before computing eventual results. For this reason
 it is safer to access the contents of a Rect by using the provided
 API at all times, instead of directly accessing the structure members.
Since: 1.12
Synopsis
- newtype Rect = Rect (ManagedPtr Rect)
 - newZeroRect :: MonadIO m => m Rect
 - rectAlloc :: (HasCallStack, MonadIO m) => m Rect
 - rectClampToPixel :: (HasCallStack, MonadIO m) => Rect -> m ()
 - rectContainsPoint :: (HasCallStack, MonadIO m) => Rect -> Point -> m Bool
 - rectContainsRect :: (HasCallStack, MonadIO m) => Rect -> Rect -> m Bool
 - rectCopy :: (HasCallStack, MonadIO m) => Rect -> m Rect
 - rectEquals :: (HasCallStack, MonadIO m) => Rect -> Rect -> m Bool
 - rectFree :: (HasCallStack, MonadIO m) => Rect -> m ()
 - rectGetCenter :: (HasCallStack, MonadIO m) => Rect -> m Point
 - rectGetHeight :: (HasCallStack, MonadIO m) => Rect -> m Float
 - rectGetWidth :: (HasCallStack, MonadIO m) => Rect -> m Float
 - rectGetX :: (HasCallStack, MonadIO m) => Rect -> m Float
 - rectGetY :: (HasCallStack, MonadIO m) => Rect -> m Float
 - rectInit :: (HasCallStack, MonadIO m) => Rect -> Float -> Float -> Float -> Float -> m Rect
 - rectInset :: (HasCallStack, MonadIO m) => Rect -> Float -> Float -> m ()
 - rectIntersection :: (HasCallStack, MonadIO m) => Rect -> Rect -> m (Bool, Rect)
 - rectNormalize :: (HasCallStack, MonadIO m) => Rect -> m Rect
 - rectOffset :: (HasCallStack, MonadIO m) => Rect -> Float -> Float -> m ()
 - rectUnion :: (HasCallStack, MonadIO m) => Rect -> Rect -> m Rect
 - rectZero :: (HasCallStack, MonadIO m) => m Rect
 - getRectOrigin :: MonadIO m => Rect -> m Point
 - getRectSize :: MonadIO m => Rect -> m Size
 
Exported types
Memory-managed wrapper type.
Instances
| Eq Rect Source # | |
| GBoxed Rect Source # | |
Defined in GI.Clutter.Structs.Rect  | |
| ManagedPtrNewtype Rect Source # | |
Defined in GI.Clutter.Structs.Rect Methods toManagedPtr :: Rect -> ManagedPtr Rect  | |
| TypedObject Rect Source # | |
Defined in GI.Clutter.Structs.Rect  | |
| HasParentTypes Rect Source # | |
Defined in GI.Clutter.Structs.Rect  | |
| tag ~ 'AttrSet => Constructible Rect tag Source # | |
| IsGValue (Maybe Rect) Source # | Convert   | 
Defined in GI.Clutter.Structs.Rect Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Rect -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Rect)  | |
| type ParentTypes Rect Source # | |
Defined in GI.Clutter.Structs.Rect  | |
Methods
Click to display all available methods, including inherited ones
Methods
clampToPixel, containsPoint, containsRect, copy, equals, free, init, inset, intersection, normalize, offset, union.
Getters
getCenter, getHeight, getWidth, getX, getY.
Setters
None.
alloc
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Rect | Returns: the newly allocated   | 
clampToPixel
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> m () | 
Rounds the origin of rect downwards to the nearest integer, and rounds
 the size of rect upwards to the nearest integer, so that rect is
 updated to the smallest rectangle capable of fully containing the
 original, fractional rectangle.
Since: 1.12
containsPoint
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> Point | 
  | 
| -> m Bool | Returns:   | 
Checks whether point is contained by rect, after normalizing the
 rectangle.
Since: 1.12
containsRect
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> Rect | 
  | 
| -> m Bool | Returns:   | 
Checks whether a contains b.
The first rectangle contains the second if the union of the
 two Rect is equal to the first rectangle.
Since: 1.12
copy
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> m Rect | Returns: the newly allocate copy of   | 
Copies rect into a new Rect instance.
Since: 1.12
equals
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> Rect | 
  | 
| -> m Bool | Returns:   | 
Checks whether a and b are equals.
This function will normalize both a and b before comparing
 their origin and size.
Since: 1.12
free
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> m () | 
Frees the resources allocated by rect.
Since: 1.12
getCenter
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> m Point | 
Retrieves the center of rect, after normalizing the rectangle,
 and updates center with the correct coordinates.
Since: 1.12
getHeight
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> m Float | Returns: the height of the rectangle  | 
Retrieves the height of rect.
Since: 1.12
getWidth
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> m Float | Returns: the width of the rectangle  | 
Retrieves the width of rect.
Since: 1.12
getX
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> m Float | Returns: the X coordinate of the origin of the rectangle  | 
Retrieves the X coordinate of the origin of rect.
Since: 1.12
getY
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> m Float | Returns: the Y coordinate of the origin of the rectangle  | 
Retrieves the Y coordinate of the origin of rect.
Since: 1.12
init
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> Float | 
  | 
| -> Float | 
  | 
| -> Float | 
  | 
| -> Float | 
  | 
| -> m Rect | Returns: the updated rectangle  | 
Initializes a Rect with the given origin and size.
Since: 1.12
inset
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> Float | 
  | 
| -> Float | 
  | 
| -> m () | 
Normalizes the rect and offsets its origin by the dX and dY values;
 the size is adjusted by (2 * dX, 2 * dY).
If dX and dY are positive the size of the rectangle is decreased; if
 the values are negative, the size of the rectangle is increased.
If the resulting rectangle has a negative width or height, the size is set to 0.
Since: 1.12
intersection
normalize
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> m Rect | 
Normalizes a Rect.
A Rect is defined by the area covered by its size; this means
 that a Rect with Rect.origin in [ 0, 0 ] and a
 Rect.size of [ 10, 10 ] is equivalent to a Rect with
 Rect.origin in [ 10, 10 ] and a Rect.size of [ -10, -10 ].
This function is useful to ensure that a rectangle has positive width
 and height; it will modify the passed rect and normalize its size.
Since: 1.12
offset
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Rect | 
  | 
| -> Float | 
  | 
| -> Float | 
  | 
| -> m () | 
Offsets the origin of rect by the given values, after normalizing
 the rectangle.
Since: 1.12
union
Computes the smallest possible rectangle capable of fully containing
 both a and b, and places it into res.
This function will normalize both a and b prior to computing their
 union.
Since: 1.12
zero
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Rect | Returns: a rectangle with origin in (0, 0) and a size of 0.
   The returned   | 
Properties
origin
the origin of the rectangle
getRectOrigin :: MonadIO m => Rect -> m Point Source #
Get the value of the “origin” field.
 When overloading is enabled, this is equivalent to
get rect #origin
size
the size of the rectangle
getRectSize :: MonadIO m => Rect -> m Size Source #
Get the value of the “size” field.
 When overloading is enabled, this is equivalent to
get rect #size