utils

package
v0.0.0-...-fe689bf Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(x int) int

func FileExists

func FileExists(filename string) bool

func Max

func Max(x, y int) int

func Min

func Min(x, y int) int

Types

type Point

type Point struct {
	X, Y int
}

func NewPoint

func NewPoint(x, y int) Point

func (Point) CairoLineTo

func (point Point) CairoLineTo(ctx *cairo.Context)

func (Point) CairoMoveTo

func (point Point) CairoMoveTo(ctx *cairo.Context)

func (Point) DistanceTo

func (point Point) DistanceTo(pt Point) float64

func (Point) ManhattanDistanceTo

func (point Point) ManhattanDistanceTo(pt Point) int

func (Point) Negated

func (point Point) Negated() Point

func (Point) Rotated

func (point Point) Rotated(angle float64) Point

func (Point) TranslatedBy

func (point Point) TranslatedBy(pt Point) Point

func (Point) TranslatedByXY

func (point Point) TranslatedByXY(x, y int) Point

type PointF

type PointF struct {
	X, Y float64
}

func NewPointF

func NewPointF(x, y float64) PointF

func NewPointFFromPoint

func NewPointFFromPoint(point Point) PointF

func (PointF) CairoLineTo

func (point PointF) CairoLineTo(ctx *cairo.Context)

func (PointF) CairoMoveTo

func (point PointF) CairoMoveTo(ctx *cairo.Context)

func (PointF) Length

func (point PointF) Length() float64

func (PointF) MultipliedBy

func (point PointF) MultipliedBy(value float64) PointF

func (PointF) Negated

func (point PointF) Negated() PointF

func (PointF) Normalized

func (point PointF) Normalized() PointF

func (PointF) Rotated

func (point PointF) Rotated(angle float64) PointF

func (PointF) RotatedDegree

func (point PointF) RotatedDegree(angle float64) PointF

func (PointF) ToPoint

func (point PointF) ToPoint() Point

type Rectangle

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

func NewRectangleFromLTRB

func NewRectangleFromLTRB(l, t, r, b int) Rectangle

func NewRectangleFromPoints

func NewRectangleFromPoints(Point1, Point2 Point) Rectangle

func NewRectangleFromXYWH

func NewRectangleFromXYWH(x, y, w, h int) Rectangle

func (Rectangle) Contains

func (rect Rectangle) Contains(point Point) bool

func (Rectangle) Format

func (rect Rectangle) Format() string

func (Rectangle) GetLTRB

func (rect Rectangle) GetLTRB() (int, int, int, int)

func (Rectangle) GetXYWH

func (rect Rectangle) GetXYWH() (int, int, int, int)

func (Rectangle) Height

func (rect Rectangle) Height() int

func (*Rectangle) MoveLTRB

func (rect *Rectangle) MoveLTRB(leftOffset int, topOffset int, rightOffset int, bottomOffset int)

func (Rectangle) Scaled

func (rect Rectangle) Scaled(scale float32) Rectangle

func (Rectangle) SetToCairo

func (rect Rectangle) SetToCairo(ctx *cairo.Context)

func (Rectangle) Size

func (rect Rectangle) Size() Point

func (Rectangle) Width

func (rect Rectangle) Width() int

func (Rectangle) X

func (rect Rectangle) X() int

func (Rectangle) Y

func (rect Rectangle) Y() int

Jump to

Keyboard shortcuts

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