gi-gsk-4.0.2: Gsk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

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 rectanlge are normalized and ensure that the corner values are positive and the corners do not overlap. All functions taking a RoundedRect as an argument will internally operate on a normalized copy; all functions returning a RoundedRect will always return a normalized one.

Synopsis

Exported types

newtype RoundedRect Source #

Memory-managed wrapper type.

newZeroRoundedRect :: MonadIO m => m RoundedRect Source #

Construct a RoundedRect struct initialized to zero.

Methods

Overloaded methods

containsPoint

roundedRectContainsPoint Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RoundedRect

self: a RoundedRect

-> 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. This function returns False if the point is in the rounded corner areas.

containsRect

roundedRectContainsRect Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RoundedRect

self: a RoundedRect

-> Rect

rect: the rectangle to check

-> m Bool

Returns: True if the rect is fully contained inside the rounded rectangle

Checks if the given rect is contained inside the rounded rectangle. This function returns False if rect extends into one of the rounded corner areas.

init

roundedRectInit Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RoundedRect

self: The RoundedRect to initialize

-> Rect

bounds: a Rect 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 rectangle

Initializes the given RoundedRect with the given values.

This function will implicitly normalize the RoundedRect before returning.

initCopy

roundedRectInitCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RoundedRect

self: a RoundedRect

-> RoundedRect

src: a RoundedRect

-> m RoundedRect

Returns: the initialized rectangle

Initializes self using the given src rectangle.

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

initFromRect

roundedRectInitFromRect Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RoundedRect

self: a RoundedRect

-> Rect

bounds: a Rect

-> Float

radius: the border radius

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

self: a RoundedRect

-> Rect

rect: the rectangle to check

-> m Bool

Returns: True if the rect intersects with the rounded rectangle

Checks if part of the given rect is contained inside the rounded rectangle. This function returns False if rect only extends into one of the rounded corner areas but not into the rounded rectangle itself.

isRectilinear

roundedRectIsRectilinear Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RoundedRect

self: the RoundedRect to check

-> m Bool

Returns: True if the rectangle is rectilinear

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

roundedRectNormalize Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RoundedRect

self: a RoundedRect

-> m RoundedRect

Returns: the normalized rectangle

Normalizes the passed rectangle.

this function will ensure that the bounds of the rectanlge 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 RoundedRect

-> Float

dx: the horizontal offset

-> Float

dy: the vertical offset

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

roundedRectShrink Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> RoundedRect

self: The RoundedRect 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 RoundedRect

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