Fyne API "fyne.Size"

fyne.Size


import "fyne.io/fyne/v2"

Usage

type Size

type Size struct {
	Width  float32 // The number of units along the X axis.
	Height float32 // The number of units along the Y axis.
}

Size describes something with width and height.

func MeasureText

func MeasureText(text string, size float32, style TextStyle) Size

MeasureText uses the current driver to calculate the size of text when rendered.

func NewSize

func NewSize(w float32, h float32) Size

NewSize returns a newly allocated Size of the specified dimensions.

func NewSquareSize

func NewSquareSize(side float32) Size

NewSquareSize returns a newly allocated Size with the same width and height.

Since: 2.4

func (Size) Add

func (s Size) Add(v Vector2) Size

Add returns a new Size that is the result of increasing the current size by s2 Width and Height.

func (Size) AddWidthHeight

func (s Size) AddWidthHeight(width, height float32) Size

AddWidthHeight returns a new Size by adding width and height to the current one.

func (Size) Components

func (s Size) Components() (float32, float32)

Components returns the Width and Height elements of this Size

func (Size) IsZero

func (s Size) IsZero() bool

IsZero returns whether the Size has zero width and zero height.

func (Size) Max

func (s Size) Max(v Vector2) Size

Max returns a new Size that is the maximum of the current Size and s2.

func (Size) Min

func (s Size) Min(v Vector2) Size

Min returns a new Size that is the minimum of the current Size and s2.

func (Size) Subtract

func (s Size) Subtract(v Vector2) Size

Subtract returns a new Size that is the result of decreasing the current size by s2 Width and Height.

func (Size) SubtractWidthHeight

func (s Size) SubtractWidthHeight(width, height float32) Size

SubtractWidthHeight returns a new Size by subtracting width and height from the current one.