primitives/style.go

Functions Structs Interfaces

Functions

func IsZero

IsZero returns true if the border has no visible thickness.

func (b Border) IsZero() bool {
	return b.Width <= 0 || b.Color.IsTransparent()
}

func IsZero

IsZero returns true if the shadow has no elevation.

func (s Shadow) IsZero() bool {
	return s.Level <= 0
}

func String

String returns a human-readable name for the text overflow mode.

func (o TextOverflow) String() string {
	if int(o) < len(textOverflowNames) {
		return textOverflowNames[o]
	}
	return unknownStr
}

func String

String returns a human-readable name for the image fit mode.

func (f ImageFit) String() string {
	if int(f) < len(imageFitNames) {
		return imageFitNames[f]
	}
	return unknownStr
}

func String

String returns a human-readable name for the layout direction.

func (d Direction) String() string {
	if int(d) < len(directionNames) {
		return directionNames[d]
	}
	return unknownStr
}

Structs

type Border struct

Border describes the border of a widget.

type Border struct {
	// Width is the border thickness in logical pixels.
	Width	float32
	// Color is the border color.
	Color	widget.Color
}

type Shadow struct

Shadow describes a box shadow with an integer elevation level (0-5).

 

Level 0 means no shadow. Higher levels produce progressively larger and

more diffuse shadows. The rendering of each level is determined by the

current theme; the primitives package uses a simple constant lookup.

type Shadow struct {
	// Level is the elevation level from 0 (none) to maxShadowLevel.
	Level int
}

Interfaces

type ImageSource interface

ImageSource provides the natural dimensions of an image.

 

Concrete implementations are provided by the rendering backend. The

primitives package only queries the image bounds for layout; actual

pixel data is drawn by the backend-specific Canvas implementation.

type ImageSource interface {
	// Bounds returns the natural pixel dimensions of the image.
	Bounds() [2]float32
}