util

package
v0.0.0-...-c28a7d2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BlackColor  = color.NRGBA{R: 0x00, G: 0x00, B: 0x00, A: 0xFF}
	WhiteColor  = color.NRGBA{R: 0xFF, G: 0xFF, B: 0xFF, A: 0xFF}
	GrayColor   = color.NRGBA{R: 0x80, G: 0x80, B: 0x80, A: 0xFF}
	RedColor    = color.NRGBA{R: 0xC0, G: 0x40, B: 0x40, A: 0xFF}
	YellowColor = color.NRGBA{R: 0xC0, G: 0xC0, B: 0x40, A: 0xFF}
	GreenColor  = color.NRGBA{R: 0x40, G: 0xC0, B: 0x40, A: 0xFF}
	BlueColor   = color.NRGBA{R: 0x40, G: 0x40, B: 0xC0, A: 0xFF}
)

Functions

func DrawArrow

func DrawArrow(ops *op.Ops, start, end image.Point, squareSize f32.Point, width float32, color color.NRGBA)

func DrawCircle

func DrawCircle(ops *op.Ops, rect image.Rectangle, width float32, color color.NRGBA)

func DrawCross

func DrawCross(ops *op.Ops, rect image.Rectangle, width float32, color color.NRGBA)

func DrawEllipse

func DrawEllipse(ops *op.Ops, rect image.Rectangle, color color.NRGBA)

func DrawImage

func DrawImage(ops *op.Ops, img image.Image, at image.Point, factor f32.Point)

func DrawPane

func DrawPane(ops *op.Ops, rect image.Rectangle, color color.NRGBA)

func DrawRectangle

func DrawRectangle(ops *op.Ops, rect image.Rectangle, width float32, color color.NRGBA)

func Floor

func Floor[F Float](val F) int

func IsPromotionMove

func IsPromotionMove(square chess.Square, piece chess.Piece) bool

func Min

func Min[T constraints.Ordered](a, b T) T

func OpenImage

func OpenImage(filename string) (image.Image, error)

func PointToSquare

func PointToSquare(point f32.Point, size float32, flipped bool) chess.Square

func Rect

func Rect(origin, size image.Point) image.Rectangle

func Round

func Round[F Float](val F) int

func SquareColor

func SquareColor(square chess.Square) chess.Color

func SquareToPoint

func SquareToPoint(square chess.Square, size float32, flipped bool) f32.Point

func ToF32

func ToF32(pt image.Point) f32.Point

func Transparentize

func Transparentize(c color.NRGBA, percent float32) color.NRGBA

Types

type Float

type Float interface {
	float32 | float64
}

Jump to

Keyboard shortcuts

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