util

package
v0.0.0-...-6f71fe9 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Width4K  = 3840            // 4K resolution
	Height4K = 2160            // 4K resolution
	ToRad    = math.Pi / 180.0 // Degrees to Radians
)
View Source
const (
	TestCardBasePriority   = 1100 // TestCards background
	TestCardLowerPriority  = 1125 // TestCards mid-ground
	TestCardUpperPriority  = 1175 // TestCards mid-ground
	TestCardTopPriority    = 1199 // TestCards foreground
	DialBackgroundPriority = 2000 // Clock dial background
	ClockPriority          = 2040 // Countdown Clock
	DialForegroundPriority = 2050 // Clock dial foreground
	TitlePriority          = 2100 // Title
	BoxPriority            = 3000 // Box and derivatives if not implicitly defined
)

Renderer priorities

Variables

This section is empty.

Functions

func DrawColourBars

func DrawColourBars(gc *draw2dimg.GraphicContext, bounds Rectangle, cols ...color.Color) (float64, float64)

func DrawColourBarsVertical

func DrawColourBarsVertical(gc *draw2dimg.GraphicContext, bounds Rectangle, cols ...color.Color) (float64, float64)

func DrawString

func DrawString(gc *draw2dimg.GraphicContext, x, y float64, s string, a ...interface{}) float64

func FitString

func FitString(l, t, r, b, sl, st, sr, sb float64) (float64, float64, float64, float64)

func FloatToA

func FloatToA(v float64) string

func Limit

func Limit(d, a, b int) int

Limit limits d so it lies within a and b inclusively.

func LimitU16

func LimitU16(d int) uint16

LimitU16 limits d within 0...65535

func LimitU32

func LimitU32(d int) uint32

LimitU32 is identical to LimitU16 but used as image.RGBA uses uint32 with uint16 limits

func LimitU8

func LimitU8(d int) uint8

LimitU8 limits d within 0...255

func Max

func Max(a, b int) int

func MaxSlice

func MaxSlice(a []uint32) uint32

MaxSlice returns the max values for a slice

func MaxU32

func MaxU32(a, b uint32) uint32

func MaxU8

func MaxU8(a, b uint8) uint8

func Min

func Min(a, b int) int

func MinMax

func MinMax(a []uint32) (uint32, uint32)

MinMax returns the min and max values for a slice

func MinU32

func MinU32(a, b uint32) uint32

func MinU8

func MinU8(a, b uint8) uint8

func Within

func Within(frame, start, end int) bool

Within returns true if frame is within start...end inclusively

Types

type Rectangle

type Rectangle struct {
	X1, Y1, X2, Y2 float64
}

func GetStringBounds

func GetStringBounds(gc *draw2dimg.GraphicContext, s string) Rectangle

func Rect

func Rect(x1, y1, x2, y2 float64) Rectangle

func StringSize

func StringSize(gc *draw2dimg.GraphicContext, s string, a ...interface{}) Rectangle

func (Rectangle) Add

func (r Rectangle) Add(b Rectangle) Rectangle

Add returns a Rectangle that contains both rectangles

func (Rectangle) Expand

func (r Rectangle) Expand(l, t, right, b float64) Rectangle

func (Rectangle) Height

func (r Rectangle) Height() float64

func (Rectangle) IsZero

func (r Rectangle) IsZero() bool

func (Rectangle) Reduce

func (r Rectangle) Reduce(l, t, right, b float64) Rectangle

func (Rectangle) String

func (r Rectangle) String() string

func (Rectangle) Width

func (r Rectangle) Width() float64

Directories

Path Synopsis
goexr
exr
Package exr contains an implementation of an OpenEXR image decoder.
Package exr contains an implementation of an OpenEXR image decoder.
Package units defines units of length such as inches or pixels.
Package units defines units of length such as inches or pixels.

Jump to

Keyboard shortcuts

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