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.Gsk.Structs.RoundedRect
Description
A rectangular region with rounded corners.
Application code should normalize rectangles using
roundedRectNormalize
; this function will ensure that
the bounds of the rectangle are normalized and ensure that the corner
values are positive and the corners do not overlap.
All functions taking a GskRoundedRect
as an argument will internally
operate on a normalized copy; all functions returning a GskRoundedRect
will always return a normalized one.
The algorithm used for normalizing corner sizes is described in the CSS specification.
Synopsis
- newtype RoundedRect = RoundedRect (ManagedPtr RoundedRect)
- newZeroRoundedRect :: MonadIO m => m RoundedRect
- roundedRectContainsPoint :: (HasCallStack, MonadIO m) => RoundedRect -> Point -> m Bool
- roundedRectContainsRect :: (HasCallStack, MonadIO m) => RoundedRect -> Rect -> m Bool
- roundedRectInit :: (HasCallStack, MonadIO m) => RoundedRect -> Rect -> Size -> Size -> Size -> Size -> m RoundedRect
- roundedRectInitCopy :: (HasCallStack, MonadIO m) => RoundedRect -> RoundedRect -> m RoundedRect
- roundedRectInitFromRect :: (HasCallStack, MonadIO m) => RoundedRect -> Rect -> Float -> m RoundedRect
- roundedRectIntersectsRect :: (HasCallStack, MonadIO m) => RoundedRect -> Rect -> m Bool
- roundedRectIsRectilinear :: (HasCallStack, MonadIO m) => RoundedRect -> m Bool
- roundedRectNormalize :: (HasCallStack, MonadIO m) => RoundedRect -> m RoundedRect
- roundedRectOffset :: (HasCallStack, MonadIO m) => RoundedRect -> Float -> Float -> m RoundedRect
- roundedRectShrink :: (HasCallStack, MonadIO m) => RoundedRect -> Float -> Float -> Float -> Float -> m RoundedRect
- getRoundedRectBounds :: MonadIO m => RoundedRect -> m Rect
Exported types
newtype RoundedRect Source #
Memory-managed wrapper type.
Constructors
RoundedRect (ManagedPtr RoundedRect) |
Instances
Eq RoundedRect Source # | |
Defined in GI.Gsk.Structs.RoundedRect | |
BoxedPtr RoundedRect Source # | |
Defined in GI.Gsk.Structs.RoundedRect | |
CallocPtr RoundedRect Source # | |
Defined in GI.Gsk.Structs.RoundedRect Methods boxedPtrCalloc :: IO (Ptr RoundedRect) | |
ManagedPtrNewtype RoundedRect Source # | |
Defined in GI.Gsk.Structs.RoundedRect Methods toManagedPtr :: RoundedRect -> ManagedPtr RoundedRect | |
tag ~ 'AttrSet => Constructible RoundedRect tag Source # | |
Defined in GI.Gsk.Structs.RoundedRect Methods new :: MonadIO m => (ManagedPtr RoundedRect -> RoundedRect) -> [AttrOp RoundedRect tag] -> m RoundedRect |
newZeroRoundedRect :: MonadIO m => m RoundedRect Source #
Construct a RoundedRect
struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
Methods
containsPoint, containsRect, init, initCopy, initFromRect, intersectsRect, isRectilinear, normalize, offset, shrink.
Getters
None.
Setters
None.
containsPoint
roundedRectContainsPoint Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> Point |
|
-> m Bool | Returns: |
Checks if the given point
is inside the rounded rectangle.
containsRect
roundedRectContainsRect Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> Rect |
|
-> m Bool | Returns: |
Checks if the given rect
is contained inside the rounded rectangle.
init
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> Rect |
|
-> Size |
|
-> Size |
|
-> Size |
|
-> Size |
|
-> m RoundedRect | Returns: the initialized rectangle |
Initializes the given GskRoundedRect
with the given values.
This function will implicitly normalize the GskRoundedRect
before returning.
initCopy
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> RoundedRect |
|
-> m RoundedRect | Returns: the initialized rectangle |
Initializes self
using the given src
rectangle.
This function will not normalize the GskRoundedRect
,
so make sure the source is normalized.
initFromRect
roundedRectInitFromRect Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> Rect |
|
-> Float |
|
-> m RoundedRect | Returns: the initialized rectangle |
Initializes self
to the given bounds
and sets the radius
of all four corners to radius
.
intersectsRect
roundedRectIntersectsRect Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> Rect |
|
-> m Bool | Returns: |
Checks if part of the given rect
is contained inside the rounded rectangle.
isRectilinear
roundedRectIsRectilinear Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> m Bool | Returns: |
Checks if all corners of self
are right angles and the
rectangle covers all of its bounds.
This information can be used to decide if clipNodeNew
or roundedClipNodeNew
should be called.
normalize
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> m RoundedRect | Returns: the normalized rectangle |
Normalizes the passed rectangle.
This function will ensure that the bounds of the rectangle are normalized and ensure that the corner values are positive and the corners do not overlap.
offset
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> Float |
|
-> Float |
|
-> m RoundedRect | Returns: the offset rectangle |
Offsets the bound's origin by dx
and dy
.
The size and corners of the rectangle are unchanged.
shrink
Arguments
:: (HasCallStack, MonadIO m) | |
=> RoundedRect |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> Float |
|
-> m RoundedRect | Returns: the resized |
Shrinks (or grows) the given rectangle by moving the 4 sides according to the offsets given.
The corner radii will be changed in a way that tries to keep the center of the corner circle intact. This emulates CSS behavior.
This function also works for growing rectangles if you pass
negative values for the top
, right
, bottom
or left
.
Properties
bounds
the bounds of the rectangle
getRoundedRectBounds :: MonadIO m => RoundedRect -> m Rect Source #
Get the value of the “bounds
” field.
When overloading is enabled, this is equivalent to
get
roundedRect #bounds