utils

package
v0.0.0-...-e7615e3 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToString

func BoolToString(b bool) string

func Clamp

func Clamp[T constraints.Integer | constraints.Float](min, value, max T) T

func CopyImage

func CopyImage(img image.Image) error

func ForPixel

func ForPixel(width, height int, f func(x, y int))

ForPixel iterates over every pixel coordinate in the range of width * height, calling f for each coordinate.

func LoadFile

func LoadFile(filename string) ([]byte, error)

LoadFile loads the given file and performs decompression if necessary.

func ResizeWithAspectRatio

func ResizeWithAspectRatio(img image.Image, targetWidth, targetHeight int) image.Image

ResizeWithAspectRatio resizes the input image to fit within the target width and height while maintaining aspect ratio, filling the empty space with black if needed.

func Rotate2DFrame

func Rotate2DFrame(frame *[144][160][3]uint8, angleX, angleY float64)

Rotate2DFrame rotates a 2D framebuffer in 3D space with perspective correction.

func ShakeFrame

func ShakeFrame(frame *[144][160][3]uint8, offset int)

ShakeFrame shakes the given frame in place, using the offset to apply an oscillation.

func Unzip

func Unzip(zipFile, destFolder string) error

func ZeroAdjust8

func ZeroAdjust8(v uint8) uint8

Types

This section is empty.

Jump to

Keyboard shortcuts

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