Package ch.bailu.gtk.gsk
Klasse RoundedRect
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.type.Record
ch.bailu.gtk.gsk.RoundedRect
- Alle implementierten Schnittstellen:
PointerInterface
A rectangular region with rounded corners.
Application code should normalize rectangles using
[method@Gsk.RoundedRect.normalize]; 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](https://drafts.csswg.org/css-backgrounds-3/#border-radius).
Application code should normalize rectangles using
[method@Gsk.RoundedRect.normalize]; 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](https://drafts.csswg.org/css-backgrounds-3/#border-radius).
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final String
the bounds of the rectangle
Private field: direct-type -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
containsPoint
(Point point) Checks if the given point is inside the rounded rectangle.boolean
containsRect
(Rect rect) Checks if the given rectangle is contained inside the rounded rectangle.static ClassHandler
Initializes a rounded rectangle with the given values.initCopy
(RoundedRect src) Initializes a rounded rectangle with a copy.initFromRect
(Rect bounds, float radius) Initializes a rounded rectangle to the given bounds
and sets the radius of all four corners equally.boolean
intersectsRect
(Rect rect) Checks if part a rectangle is contained
inside the rounded rectangle.boolean
Checks if all corners of a rounded rectangle are right angles
and the rectangle covers all of its bounds.Normalizes a rounded rectangle.offset
(float dx, float dy) Offsets the rounded rectangle's origin by @dx and @dy.shrink
(float top, float right, float bottom, float left) Shrinks (or grows) a rounded rectangle by moving the 4 sides
according to the offsets given.Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
BOUNDS
the bounds of the rectangle
Private field: direct-type- Siehe auch:
-
-
Konstruktordetails
-
RoundedRect
-
-
Methodendetails
-
getClassHandler
-
containsPoint
Checks if the given point is inside the rounded rectangle.- Parameter:
point
- the point to check- Gibt zurück:
- true if the point is inside the rounded rectangle
-
containsRect
Checks if the given rectangle is contained inside the rounded rectangle.- Parameter:
rect
- the rectangle to check- Gibt zurück:
- true if the @rect is fully contained inside the rounded rectangle
-
init
public RoundedRect init(@Nonnull Rect bounds, @Nonnull Size top_left, @Nonnull Size top_right, @Nonnull Size bottom_right, @Nonnull Size bottom_left) Initializes a rounded rectangle with the given values.
This function will implicitly normalize the rounded rectangle
before returning.- Parameter:
bounds
- a `graphene_rect_t` describing the boundstop_left
- the rounding radius of the top left cornertop_right
- the rounding radius of the top right cornerbottom_right
- the rounding radius of the bottom right cornerbottom_left
- the rounding radius of the bottom left corner- Gibt zurück:
- the initialized rounded rectangle
-
initCopy
Initializes a rounded rectangle with a copy.
This function will not normalize the rounded rectangle,
so make sure the source is normalized.- Parameter:
src
- another rounded rectangle- Gibt zurück:
- the initialized rounded rectangle
-
initFromRect
Initializes a rounded rectangle to the given bounds
and sets the radius of all four corners equally.- Parameter:
bounds
- a `graphene_rect_t`radius
- the border radius- Gibt zurück:
- the initialized rounded rectangle
-
intersectsRect
Checks if part a rectangle is contained
inside the rounded rectangle.- Parameter:
rect
- the rectangle to check- Gibt zurück:
- true if the @rect intersects with the rounded rectangle
-
isRectilinear
public boolean isRectilinear()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 [ctor@Gsk.ClipNode.new]
or [ctor@Gsk.RoundedClipNode.new] should be called.- Gibt zurück:
- true if the rounded rectangle is rectilinear
-
normalize
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.- Gibt zurück:
- the normalized rounded rectangle
-
offset
Offsets the rounded rectangle's origin by @dx and @dy.
The size and corners of the rounded rectangle are unchanged.- Parameter:
dx
- the horizontal offsetdy
- the vertical offset- Gibt zurück:
- the offset rounded rectangle
-
shrink
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.- Parameter:
top
- how far to move the top side downwardsright
- how far to move the right side to the leftbottom
- how far to move the bottom side upwardsleft
- how far to move the left side to the right- Gibt zurück:
- the resized rounded rectangle
-