gi-gsk-4.0.9: Gsk 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.Gsk.Structs.RoundedRect

Contents

- Exported types
- Methods
  - containsPoint
  - containsRect
  - init
  - initCopy
  - initFromRect
  - intersectsRect
  - isRectilinear
  - normalize
  - offset
  - shrink
- Properties
  - bounds

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

Instances details

Eq RoundedRect Source # |
Instance details Defined in GI.Gsk.Structs.RoundedRect Methods (==) :: RoundedRect -> RoundedRect -> Bool Source # (/=) :: RoundedRect -> RoundedRect -> Bool Source #
BoxedPtr RoundedRect Source # |
Instance details Defined in GI.Gsk.Structs.RoundedRect Methods boxedPtrCopy :: RoundedRect -> IO RoundedRect Source # boxedPtrFree :: RoundedRect -> IO () Source #
CallocPtr RoundedRect Source # |
Instance details Defined in GI.Gsk.Structs.RoundedRect Methods boxedPtrCalloc :: IO (Ptr RoundedRect) Source #
ManagedPtrNewtype RoundedRect Source # |
Instance details Defined in GI.Gsk.Structs.RoundedRect Methods toManagedPtr :: RoundedRect -> ManagedPtr RoundedRect Source #
tag ~ 'AttrSet => Constructible RoundedRect tag Source # |
Instance details Defined in GI.Gsk.Structs.RoundedRect Methods new :: MonadIO m => (ManagedPtr RoundedRect -> RoundedRect) -> [AttrOp RoundedRect tag] -> m RoundedRect Source #

newZeroRoundedRect :: MonadIO m => m RoundedRect Source #

Construct a `RoundedRect` struct initialized to zero.

# Methods

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

Expand

#### Methods

containsPoint, containsRect, init, initCopy, initFromRect, intersectsRect, isRectilinear, normalize, offset, shrink.

#### Getters

None.

#### Setters

None.

## containsPoint

roundedRectContainsPoint Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: a rounded rectangle
-> Point | `point`: the point to check
-> m Bool | Returns: true if the point is inside the rounded rectangle

Checks if the given point is inside the rounded rectangle.

## containsRect

roundedRectContainsRect Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: a rounded rectangle
-> Rect | `rect`: the rectangle to check
-> m Bool | Returns: true if the `rect` is fully contained inside the rounded rectangle

Checks if the given rectangle is contained inside the rounded rectangle.

## init

roundedRectInit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: the rounded rectangle to initialize
-> Rect | `bounds`: a `graphene_rect_t` describing the bounds
-> Size | `topLeft`: the rounding radius of the top left corner
-> Size | `topRight`: the rounding radius of the top right corner
-> Size | `bottomRight`: the rounding radius of the bottom right corner
-> Size | `bottomLeft`: the rounding radius of the bottom left corner
-> m RoundedRect | Returns: the initialized rounded rectangle

Initializes a rounded rectangle with the given values.

This function will implicitly normalize the rounded rectangle before returning.

## initCopy

roundedRectInitCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: the rounded rectangle to initialize
-> RoundedRect | `src`: another rounded rectangle
-> m RoundedRect | Returns: the initialized rounded rectangle

Initializes a rounded rectangle with a copy.

This function will not normalize the rounded rectangle, so make sure the source is normalized.

## initFromRect

roundedRectInitFromRect Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: the rounded rectangle to initialize
-> Rect | `bounds`: a `graphene_rect_t`
-> Float | `radius`: the border radius
-> m RoundedRect | Returns: the initialized rounded rectangle

Initializes a rounded rectangle to the given bounds and sets the radius of all four corners equally.

## intersectsRect

roundedRectIntersectsRect Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: a rounded rectangle
-> Rect | `rect`: the rectangle to check
-> m Bool | Returns: true if the `rect` intersects with the rounded rectangle

Checks if part a rectangle is contained inside the rounded rectangle.

## isRectilinear

roundedRectIsRectilinear Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: the rounded rectangle to check
-> m Bool | Returns: true if the rounded rectangle is rectilinear

Checks if all corners of a rounded rectangle 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

roundedRectNormalize Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: a rounded rectangle
-> m RoundedRect | Returns: the normalized rounded rectangle

Normalizes a rounded rectangle.

This function will ensure that the bounds of the rounded rectangle are normalized and ensure that the corner values are positive and the corners do not overlap.

## offset

roundedRectOffset Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: a rounded rectangle
-> Float | `dx`: the horizontal offset
-> Float | `dy`: the vertical offset
-> m RoundedRect | Returns: the offset rounded rectangle

Offsets the rounded rectangle's origin by `dx` and `dy`.

The size and corners of the rounded rectangle are unchanged.

## shrink

roundedRectShrink Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> RoundedRect | `self`: the rounded rectangle to shrink or grow
-> Float | `top`: how far to move the top side downwards
-> Float | `right`: how far to move the right side to the left
-> Float | `bottom`: how far to move the bottom side upwards
-> Float | `left`: how far to move the left side to the right
-> m RoundedRect | Returns: the resized rounded rectangle

Shrinks (or grows) a rounded 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 rounded 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