Documentation
¶
Index ¶
- Variables
- type CornerRadius
- func (c CornerRadius) Div(operand float32) CornerRadius
- func (c CornerRadius) Equal(other CornerRadius) bool
- func (c CornerRadius) IsSpecified() bool
- func (c CornerRadius) IsUnspecified() bool
- func (c CornerRadius) Minus(other CornerRadius) CornerRadius
- func (c CornerRadius) Plus(other CornerRadius) CornerRadius
- func (c CornerRadius) String() string
- func (c CornerRadius) TakeOrElse(fallback CornerRadius) CornerRadius
- func (c CornerRadius) Times(operand float32) CornerRadius
- func (c CornerRadius) X() float32
- func (c CornerRadius) Y() float32
- type Offset
- func (o Offset) Div(operand float32) Offset
- func (o Offset) Equal(other Offset) bool
- func (o Offset) GetDistance() float32
- func (o Offset) GetDistanceSquared() float32
- func (o Offset) IsFinite() bool
- func (o Offset) IsInfinite() bool
- func (o Offset) IsOffset() bool
- func (o Offset) IsUnspecified() bool
- func (o Offset) IsValid() bool
- func (o Offset) Minus(other Offset) Offset
- func (o Offset) Plus(other Offset) Offset
- func (o Offset) Rem(operand float32) Offset
- func (o Offset) String() string
- func (o Offset) TakeOrElse(block Offset) Offset
- func (o Offset) Times(operand float32) Offset
- func (o Offset) UnaryMinus() Offset
- func (o Offset) X() float32
- func (o Offset) Y() float32
- type Rect
- func (r Rect) BottomCenter() Offset
- func (r Rect) BottomLeft() Offset
- func (r Rect) BottomRight() Offset
- func (r Rect) Center() Offset
- func (r Rect) CenterLeft() Offset
- func (r Rect) CenterRight() Offset
- func (r Rect) Contains(offset Offset) bool
- func (r Rect) Deflate(delta float32) Rect
- func (r Rect) Equal(other Rect) bool
- func (r Rect) Height() float32
- func (r Rect) Inflate(delta float32) Rect
- func (r Rect) Intersect(other Rect) Rect
- func (r Rect) IntersectCoords(otherLeft, otherTop, otherRight, otherBottom float32) Rect
- func (r Rect) IsEmpty() bool
- func (r Rect) IsFinite() bool
- func (r Rect) IsInfinite() bool
- func (r Rect) MaxDimension() float32
- func (r Rect) MinDimension() float32
- func (r Rect) Overlaps(other Rect) bool
- func (r Rect) Size() Size
- func (r Rect) String() string
- func (r Rect) TopCenter() Offset
- func (r Rect) TopLeft() Offset
- func (r Rect) TopRight() Offset
- func (r Rect) Translate(offset Offset) Rect
- func (r Rect) TranslateXY(translateX, translateY float32) Rect
- func (r Rect) Width() float32
- type Size
- func (s Size) Center() Offset
- func (s Size) Div(operand float32) Size
- func (s Size) Equal(other Size) bool
- func (s Size) Height() float32
- func (s Size) IsEmpty() bool
- func (s Size) IsSpecified() bool
- func (s Size) IsUnspecified() bool
- func (s Size) MaxDimension() float32
- func (s Size) MinDimension() float32
- func (s Size) String() string
- func (s Size) TakeOrElse(block Size) Size
- func (s Size) Times(operand float32) Size
- func (s Size) Width() float32
Constants ¶
This section is empty.
Variables ¶
var CornerRadiusUnspecified = NewCornerRadius(floatutils.Float32Unspecified, floatutils.Float32Unspecified)
CornerRadiusUnspecified represents an unspecified corner radius.
var CornerRadiusZero = NewCornerRadius(0, 0)
CornerRadiusZero is a CornerRadius with both x and y radii equal to zero (sharp corners).
var OffsetInfinite = NewOffset(floatutils.Float32Infinite, floatutils.Float32Infinite)
OffsetInfinite is an offset with infinite x and y components.
var OffsetUnspecified = NewOffset(floatutils.Float32Unspecified, floatutils.Float32Unspecified)
Sentinel Values OffsetUnspecified Represents an unspecified Offset value, usually a replacement for `null` when a primitive value is desired.
var OffsetZero = NewOffset(0, 0)
OffsetZero is an offset with zero magnitude.
var RectZero = Rect{Left: 0, Top: 0, Right: 0, Bottom: 0}
RectZero is a rectangle with left, top, right, and bottom edges all at zero.
var SizeUnspecified = NewSize(floatutils.Float32Unspecified, floatutils.Float32Unspecified)
SizeUnspecified Represents an unspecified Size value, usually a replacement for `null` when a primitive value is desired.
var SizeZero = NewSize(0, 0)
SizeZero is an empty size, one with a zero width and a zero height.
Functions ¶
This section is empty.
Types ¶
type CornerRadius ¶
type CornerRadius int64
CornerRadius represents the radii for corners of a rounded rectangle. It is a packed value where the x radius is in the high 32 bits and the y radius is in the low 32 bits. https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/CornerRadius.kt
func LerpCornerRadius ¶
func LerpCornerRadius(start, stop CornerRadius, fraction float32) CornerRadius
LerpCornerRadius linearly interpolates between two corner radii.
func NewCircularCornerRadius ¶
func NewCircularCornerRadius(radius float32) CornerRadius
NewCircularCornerRadius creates a CornerRadius with equal x and y radii (circular corners).
func NewCornerRadius ¶
func NewCornerRadius(x, y float32) CornerRadius
NewCornerRadius creates a CornerRadius from the given x and y radii. x is the radius of the corners along the x-axis. y is the radius of the corners along the y-axis (defaults to x if you want circular corners).
func (CornerRadius) Div ¶
func (c CornerRadius) Div(operand float32) CornerRadius
Div returns a CornerRadius with radii divided by the given factor.
func (CornerRadius) Equal ¶
func (c CornerRadius) Equal(other CornerRadius) bool
Equal checks equality with another CornerRadius.
func (CornerRadius) IsSpecified ¶
func (c CornerRadius) IsSpecified() bool
IsSpecified returns true if this is not CornerRadius.Unspecified.
func (CornerRadius) IsUnspecified ¶
func (c CornerRadius) IsUnspecified() bool
IsUnspecified returns true if this is CornerRadius.Unspecified.
func (CornerRadius) Minus ¶
func (c CornerRadius) Minus(other CornerRadius) CornerRadius
Minus returns a CornerRadius with radii that are the difference of both corner radii.
func (CornerRadius) Plus ¶
func (c CornerRadius) Plus(other CornerRadius) CornerRadius
Plus returns a CornerRadius with radii that are the sum of both corner radii.
func (CornerRadius) String ¶
func (c CornerRadius) String() string
String returns a string representation of the CornerRadius.
func (CornerRadius) TakeOrElse ¶
func (c CornerRadius) TakeOrElse(fallback CornerRadius) CornerRadius
TakeOrElse returns this corner radius if Specified, otherwise returns the fallback.
func (CornerRadius) Times ¶
func (c CornerRadius) Times(operand float32) CornerRadius
Times returns a CornerRadius with radii scaled by the given factor.
func (CornerRadius) X ¶
func (c CornerRadius) X() float32
X returns the x component of the corner radius.
func (CornerRadius) Y ¶
func (c CornerRadius) Y() float32
Y returns the y component of the corner radius.
type Offset ¶
type Offset int64
Offset is an immutable 2D floating-point offset. It is a packed value where the x coordinate is in the high 32 bits and the y coordinate is in the low 32 bits.
func LerpOffset ¶
LerpOffset linearly interpolates between two offsets.
func (Offset) Div ¶
Div returns an offset whose coordinates are the coordinates of the left-hand-side operand (an Offset) divided by the scalar right-hand-side operand (a Float).
func (Offset) GetDistance ¶
GetDistance returns the magnitude of the offset.
func (Offset) GetDistanceSquared ¶
GetDistanceSquared returns the square of the magnitude of the offset.
func (Offset) IsFinite ¶
IsFinite returns true if both x and y values of the Offset are finite. NaN values are not considered finite.
func (Offset) IsInfinite ¶
IsInfinite returns true if either x or y value of the Offset is infinite.
func (Offset) IsUnspecified ¶
IsUnspecified returns true if this is Offset.Unspecified.
func (Offset) Minus ¶
Minus returns an offset whose x value is the left-hand-side operand's x minus the right-hand-side operand's x and whose y value is the left-hand-side operand's y minus the right-hand-side operand's y.
func (Offset) Plus ¶
Plus returns an offset whose x value is the sum of the x values of the two operands, and whose y value is the sum of the y values of the two operands.
func (Offset) Rem ¶
Rem returns an offset whose coordinates are the remainder of dividing the coordinates of the left-hand-side operand (an Offset) by the scalar right-hand-side operand (a Float).
func (Offset) TakeOrElse ¶
TakeOrElse returns this offset if Specified, otherwise executes the block and returns its result.
func (Offset) Times ¶
Times returns an offset whose coordinates are the coordinates of the left-hand-side operand (an Offset) multiplied by the scalar right-hand-side operand (a Float).
func (Offset) UnaryMinus ¶
UnaryMinus returns an offset with the coordinates negated.
type Rect ¶
Rect is an immutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.
func RectFromCircle ¶
RectFromCircle constructs a rectangle that bounds the given circle.
func RectFromOffsetSize ¶
RectFromOffsetSize constructs a rectangle from its left and top edges as well as its width and height.
func RectFromTwoOffsets ¶
RectFromTwoOffsets constructs the smallest rectangle that encloses the given offsets, treating them as vectors from the origin.
func (Rect) BottomCenter ¶
BottomCenter returns the offset to the center of the bottom edge of this rectangle.
func (Rect) BottomLeft ¶
BottomLeft returns the offset to the intersection of the bottom and left edges of this rectangle.
func (Rect) BottomRight ¶
BottomRight returns the offset to the intersection of the bottom and right edges of this rectangle.
func (Rect) Center ¶
Center returns the offset to the point halfway between the left and right and the top and bottom edges.
func (Rect) CenterLeft ¶
CenterLeft returns the offset to the center of the left edge of this rectangle.
func (Rect) CenterRight ¶
CenterRight returns the offset to the center of the right edge of this rectangle.
func (Rect) Contains ¶
Contains returns whether the point specified by the given offset lies between the left and right and the top and bottom edges. Rectangles include their top and left edges but exclude their bottom and right edges.
func (Rect) Height ¶
Height returns the distance between the top and bottom edges of this rectangle.
func (Rect) Intersect ¶
Intersect returns a new rectangle that is the intersection of the given rectangle and this rectangle.
func (Rect) IntersectCoords ¶
IntersectCoords returns a new rectangle that is the intersection of the given rectangle coordinates and this rectangle.
func (Rect) IsEmpty ¶
IsEmpty returns true if this rectangle encloses a non-zero area. Negative areas are considered empty.
func (Rect) IsInfinite ¶
IsInfinite returns true if any of the coordinates of this rectangle are equal to positive infinity.
func (Rect) MaxDimension ¶
MaxDimension returns the greater of the magnitudes of the width and the height of this rectangle.
func (Rect) MinDimension ¶
MinDimension returns the lesser of the magnitudes of the width and the height of this rectangle.
func (Rect) Overlaps ¶
Overlaps returns whether `other` has a nonzero area of overlap with this rectangle.
func (Rect) Size ¶
Size returns the distance between the upper-left corner and the lower-right corner of this rectangle.
func (Rect) TopCenter ¶
TopCenter returns the offset to the center of the top edge of this rectangle.
func (Rect) TopLeft ¶
TopLeft returns the offset to the intersection of the top and left edges of this rectangle.
func (Rect) TopRight ¶
TopRight returns the offset to the intersection of the top and right edges of this rectangle.
func (Rect) TranslateXY ¶
TranslateXY returns a new rectangle with translateX added to the x components and translateY added to the y components.
type Size ¶
type Size int64
Size represents a 2D floating-point size. You can think of this as an Offset from the origin. It is a packed value where the width is in the high 32 bits and the height is in the low 32 bits.
func (Size) Center ¶
Center returns the Offset of the center of the rect from the point of [0, 0] with this Size.
func (Size) Div ¶
Div returns a Size whose dimensions are the dimensions of the left-hand-side operand (a Size) divided by the scalar right-hand-side operand (a Float).
func (Size) IsSpecified ¶
IsSpecified returns false when this is Size.Unspecified.
func (Size) IsUnspecified ¶
IsUnspecified returns true when this is Size.Unspecified.
func (Size) MaxDimension ¶
MaxDimension returns the greater of the magnitudes of the width and the height.
func (Size) MinDimension ¶
MinDimension returns the lesser of the magnitudes of the width and the height.