gioui.org: gioui.org/f32 Index | Files

package f32

import "gioui.org/f32"

Package f32 is a float32 implementation of package image's Point and Rectangle.

The coordinate space has the origin in the top left corner with the axes extending right and down.

Index

Package Files

affine.go f32.go

type Affine2D Uses

type Affine2D struct {
    // contains filtered or unexported fields
}

Affine2D represents an affine 2D transformation. The zero value if Affine2D represents the identity transform.

func NewAffine2D Uses

func NewAffine2D(sx, hx, ox, hy, sy, oy float32) Affine2D

NewAffine2D creates a new Affine2D transform from the matrix elements in row major order. The rows are: [sx, hx, ox], [hy, sy, oy], [0, 0, 1].

func (Affine2D) Elems Uses

func (a Affine2D) Elems() (sx, hx, ox, hy, sy, oy float32)

Elems returns the matrix elements of the transform in row-major order. The rows are: [sx, hx, ox], [hy, sy, oy], [0, 0, 1].

func (Affine2D) Invert Uses

func (a Affine2D) Invert() Affine2D

Invert the transformation. Note that if the matrix is close to singular numerical errors may become large or infinity.

func (Affine2D) Mul Uses

func (A Affine2D) Mul(B Affine2D) (r Affine2D)

Mul returns A*B.

func (Affine2D) Offset Uses

func (a Affine2D) Offset(offset Point) Affine2D

Offset the transformation.

func (Affine2D) Rotate Uses

func (a Affine2D) Rotate(origin Point, radians float32) Affine2D

Rotate the transformation by the given angle (in radians) counter clockwise around the given origin.

func (Affine2D) Scale Uses

func (a Affine2D) Scale(origin, factor Point) Affine2D

Scale the transformation around the given origin.

func (Affine2D) Shear Uses

func (a Affine2D) Shear(origin Point, radiansX, radiansY float32) Affine2D

Shear the transformation by the given angle (in radians) around the given origin.

func (Affine2D) Transform Uses

func (a Affine2D) Transform(p Point) Point

Transform p by returning a*p.

type Point Uses

type Point struct {
    X, Y float32
}

A Point is a two dimensional point.

func Pt Uses

func Pt(x, y float32) Point

Pt is shorthand for Point{X: x, Y: y}.

func (Point) Add Uses

func (p Point) Add(p2 Point) Point

Add return the point p+p2.

func (Point) Mul Uses

func (p Point) Mul(s float32) Point

Mul returns p scaled by s.

func (Point) String Uses

func (p Point) String() string

String return a string representation of p.

func (Point) Sub Uses

func (p Point) Sub(p2 Point) Point

Sub returns the vector p-p2.

type Rectangle Uses

type Rectangle struct {
    Min, Max Point
}

A Rectangle contains the points (X, Y) where Min.X <= X < Max.X, Min.Y <= Y < Max.Y.

func Rect Uses

func Rect(x0, y0, x1, y1 float32) Rectangle

Rect is a shorthand for Rectangle{Point{x0, y0}, Point{x1, y1}}. The returned Rectangle has x0 and y0 swapped if necessary so that it's correctly formed.

func (Rectangle) Add Uses

func (r Rectangle) Add(p Point) Rectangle

Add offsets r with the vector p.

func (Rectangle) Canon Uses

func (r Rectangle) Canon() Rectangle

Canon returns the canonical version of r, where Min is to the upper left of Max.

func (Rectangle) Dx Uses

func (r Rectangle) Dx() float32

Dx returns r's width.

func (Rectangle) Dy Uses

func (r Rectangle) Dy() float32

Dy returns r's Height.

func (Rectangle) Empty Uses

func (r Rectangle) Empty() bool

Empty reports whether r represents the empty area.

func (Rectangle) Intersect Uses

func (r Rectangle) Intersect(s Rectangle) Rectangle

Intersect returns the intersection of r and s.

func (Rectangle) Size Uses

func (r Rectangle) Size() Point

Size returns r's width and height.

func (Rectangle) String Uses

func (r Rectangle) String() string

String return a string representation of r.

func (Rectangle) Sub Uses

func (r Rectangle) Sub(p Point) Rectangle

Sub offsets r with the vector -p.

func (Rectangle) Union Uses

func (r Rectangle) Union(s Rectangle) Rectangle

Union returns the union of r and s.

Package f32 imports 2 packages (graph) and is imported by 59 packages. Updated 2020-09-29. Refresh now. Tools for package owners.