shape

package
v0.1.122 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CutCornerShapeUnspecified = &CutCornerShape{
	Radius: unit.DpUnspecified,
}
View Source
var RoundedCornerShapeUnspecified = &RoundedCornerShape{
	Radius: unit.DpUnspecified,

	TopStart:    unit.DpUnspecified,
	TopEnd:      unit.DpUnspecified,
	BottomEnd:   unit.DpUnspecified,
	BottomStart: unit.DpUnspecified,
}

Functions

func EqualShape

func EqualShape(a, b Shape) bool

func IsSpecifiedShape

func IsSpecifiedShape(s Shape) bool

func SameShape

func SameShape(a, b Shape) bool

func SemanticEqualShape

func SemanticEqualShape(a, b Shape) bool

func StringShape

func StringShape(shape Shape) string

Types

type CutCornerShape

type CutCornerShape struct {
	Radius unit.Dp
}

CutCornerShape

func (*CutCornerShape) CreateOutline

func (c *CutCornerShape) CreateOutline(size image.Point, metric gioUnit.Metric) Outline

type Outline

type Outline interface {
	Push(ops *op.Ops) clip.Stack
	Op(ops *op.Ops) clip.Op
	Path(ops *op.Ops) clip.PathSpec
}

type RoundedCornerShape

type RoundedCornerShape struct {
	// Uniform radius applied to all corners (used when per-corner fields are all zero)
	Radius unit.Dp

	// Per-corner radius (following LTR layout direction):
	// TopStart = NW (top-left), TopEnd = NE (top-right)
	// BottomEnd = SE (bottom-right), BottomStart = SW (bottom-left)
	TopStart    unit.Dp
	TopEnd      unit.Dp
	BottomEnd   unit.Dp
	BottomStart unit.Dp
}

RoundedCornerShape supports uniform radius via Radius, or per-corner radius via TopStart (NW), TopEnd (NE), BottomEnd (SE), BottomStart (SW). Per-corner fields take precedence when any are non-zero. This follows Jetpack Compose's RoundedCornerShape API.

func (*RoundedCornerShape) CreateOutline

func (r *RoundedCornerShape) CreateOutline(size image.Point, metric gioUnit.Metric) Outline

type Shape

type Shape interface {
	CreateOutline(size image.Point, metric gioUnit.Metric) Outline
	// contains filtered or unexported methods
}
var CircleShape Shape = &circleShape{}

CircleShape is a shape describing a circle.

var ShapeCircle Shape = &circleShape{}

Deprecated: Use CircleShape instead

var ShapeRectangle Shape = &rectangleShape{}
var ShapeUnspecified Shape = &ShapeUnspecifiedImpl{}

func CoalesceShape

func CoalesceShape(ptr, def Shape) Shape

func CopyShape

func CopyShape(s Shape, options ...ShapeOption) Shape

func MergeShape

func MergeShape(a, b Shape) Shape

func TakeOrElseShape

func TakeOrElseShape(s, defaultStyle Shape) Shape

type ShapeOption

type ShapeOption func(Shape)

func WithBottomEndRadius

func WithBottomEndRadius(radius unit.Dp) ShapeOption

func WithBottomStartRadius

func WithBottomStartRadius(radius unit.Dp) ShapeOption

func WithRadius

func WithRadius(radius unit.Dp) ShapeOption

func WithTopEndRadius

func WithTopEndRadius(radius unit.Dp) ShapeOption

RoundedCornerShape Options

type ShapeUnspecifiedImpl

type ShapeUnspecifiedImpl struct {
}

func (*ShapeUnspecifiedImpl) CreateOutline

func (s *ShapeUnspecifiedImpl) CreateOutline(size image.Point, metric gioUnit.Metric) Outline

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL