Package limn.graphics
Record Class RoundRect
java.lang.Object
java.lang.Record
limn.graphics.RoundRect
- Record Components:
x- left edgey- top edgewidth- widthheight- heighttopLeft- top-left corner radiustopRight- top-right corner radiusbottomRight- bottom-right corner radiusbottomLeft- bottom-left corner radius
public record RoundRect(float x, float y, float width, float height, float topLeft, float topRight, float bottomRight, float bottomLeft)
extends Record
Immutable rounded rectangle with independent corner radii, in logical
points. Radii larger than the sides allow are reduced proportionally (the
CSS border-radius rule) by
normalized().-
Constructor Summary
ConstructorsConstructorDescriptionRoundRect(float x, float y, float width, float height, float topLeft, float topRight, float bottomRight, float bottomLeft) Creates an instance of aRoundRectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the value of thebottomLeftrecord component.floatReturns the value of thebottomRightrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.floatheight()Returns the value of theheightrecord component.static RoundRectof(float x, float y, float width, float height, float radius) Rounded rect with the same radius on all four corners.floattopLeft()Returns the value of thetopLeftrecord component.floattopRight()Returns the value of thetopRightrecord component.final StringtoString()Returns a string representation of this record class.floatwidth()Returns the value of thewidthrecord component.floatx()Returns the value of thexrecord component.floaty()Returns the value of theyrecord component.
-
Constructor Details
-
RoundRect
public RoundRect(float x, float y, float width, float height, float topLeft, float topRight, float bottomRight, float bottomLeft) Creates an instance of aRoundRectrecord class.- Parameters:
x- the value for thexrecord componenty- the value for theyrecord componentwidth- the value for thewidthrecord componentheight- the value for theheightrecord componenttopLeft- the value for thetopLeftrecord componenttopRight- the value for thetopRightrecord componentbottomRight- the value for thebottomRightrecord componentbottomLeft- the value for thebottomLeftrecord component
-
-
Method Details
-
of
Rounded rect with the same radius on all four corners. -
normalized
- Returns:
- an equivalent RoundRect whose radii are guaranteed to fit the
sides: if any two radii sharing a side exceed its length, all
four are scaled down by the same factor (CSS rule). Note:
renderers additionally cap each radius at half the smaller side
(the per-quadrant SDF's validity domain), so a lone radius in
(side/2, side]draws asside/2
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
x
public float x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public float y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
width
public float width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public float height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-
topLeft
public float topLeft()Returns the value of thetopLeftrecord component.- Returns:
- the value of the
topLeftrecord component
-
topRight
public float topRight()Returns the value of thetopRightrecord component.- Returns:
- the value of the
topRightrecord component
-
bottomRight
public float bottomRight()Returns the value of thebottomRightrecord component.- Returns:
- the value of the
bottomRightrecord component
-
bottomLeft
public float bottomLeft()Returns the value of thebottomLeftrecord component.- Returns:
- the value of the
bottomLeftrecord component
-