egeom

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ZeroPoint = NewPoint(0, 0)
)

Functions

This section is empty.

Types

type Padding

type Padding interface {
	Define(obj Rectangle) Point
}

func NewPaddingFixed

func NewPaddingFixed(x, y int) Padding

func NewPaddingNone

func NewPaddingNone() Padding

func NewPaddingRatio

func NewPaddingRatio(rx, ry float64) Padding

type Point

type Point interface {
	X() int
	Y() int

	Add(x, y int) Point
	AddPoint(q Point) Point
	Sub(x, y int) Point
	SubPoint(q Point) Point

	Equals(q Point) bool

	Fixed26() fixed.Point26_6
	Fixed52() fixed.Point52_12
	ImagePoint() image.Point
}

func NewPoint

func NewPoint(x, y int) Point

func NewPointFixed26

func NewPointFixed26(q fixed.Point26_6) Point

func NewPointFixed52

func NewPointFixed52(q fixed.Point52_12) Point

func NewPointImage

func NewPointImage(q image.Point) Point

type Position

type Position int
const (
	PositionUndefined Position = iota
	PositionTopLeft
	PositionTopCenter
	PositionTopRight
	PositionCenterLeft
	PositionCenter
	PositionCenterRight
	PositionBottomLeft
	PositionBottomCenter
	PositionBottomRight
)

func ParsePosition

func ParsePosition(p string) (Position, eoutcome.ParseOutcome)

func (Position) Locate

func (z Position) Locate(base, obj Rectangle, padding Padding) Point

Locate defines top-left corner of obj location. Padding ignored if a position is center. Returns (0, 0) if undefined position

type Rectangle

type Rectangle interface {
	X() int
	Y() int
	Width() int
	Height() int

	Equals(q Rectangle) bool

	TopLeft() Point
	TopCenter() Point
	TopRight() Point
	CenterLeft() Point
	Center() Point
	CenterRight() Point
	BottomLeft() Point
	BottomCenter() Point
	BottomRight() Point

	Fixed26() fixed.Rectangle26_6
	Fixed52() fixed.Rectangle52_12
	ImageRect() image.Rectangle
}

func NewRectangle

func NewRectangle(location Point, width, height int) Rectangle

func NewRectangleFixed26

func NewRectangleFixed26(q fixed.Rectangle26_6) Rectangle

func NewRectangleFixed52

func NewRectangleFixed52(q fixed.Rectangle52_12) Rectangle

func NewRectangleImage

func NewRectangleImage(r image.Rectangle) Rectangle

Jump to

Keyboard shortcuts

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