util

package
v0.0.0-...-640e49b Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

image/color.Color implementation for HSV representation

Index

Constants

View Source
const (
	Sqrt3 = 1.732050807568877293527446341505872366942805253810380628055806
)

Variables

View Source
var (
	RED   = color.RGBA{255, 0, 0, 255}
	GREEN = color.RGBA{0, 255, 0, 255}
	BLUE  = color.RGBA{0, 0, 255, 255}
)

Functions

func ApplyMaskOnMatrix

func ApplyMaskOnMatrix[V any](dst [][]V, mask [][]bool, value V) ([][]V, error)

func AsRGBA

func AsRGBA(img image.Image) *image.RGBA

func MakeMatrix

func MakeMatrix[V any](size int, value V) [][]V

func MakeMatrixBool

func MakeMatrixBool(size int) [][]bool

func MakeMatrixWH

func MakeMatrixWH[V any](width, height int, value V) [][]V

func MakeRandMatrixBool

func MakeRandMatrixBool(size, threshold int) [][]bool

func MakeRandMatrixUint8

func MakeRandMatrixUint8(size, maxValue int) [][]uint8

func Merge2Matrixes

func Merge2Matrixes(matrixes [2][][]float32) ([][]mgl32.Vec2, error)

Types

type HSVColor

type HSVColor struct {
	H    uint16
	S, V uint8
}

HSVColor defines a color in the Hue-Saturation-Value scheme. Hue is a value [0 - 360) specifying the color Saturation is a value [0 - 255] specifying the strength of the color Value is a value [0 - 255] specifying the brightness of the color

func (HSVColor) RGBA

func (h HSVColor) RGBA() (r, g, b, a uint32)

type HexPlane

type HexPlane struct {
	Values []HexPoint
	Origin HexPoint
	Size   int
}

func NewHexBoard

func NewHexBoard(qnt int) *HexPlane

type HexPoint

type HexPoint [3]float64 // Q R S

func Cube_round

func Cube_round(hex HexPoint) HexPoint

func Pixel_to_flat_hex

func Pixel_to_flat_hex(p Point2D, size float64) HexPoint

func Pixel_to_pointy_hex

func Pixel_to_pointy_hex(p Point2D, size float64) HexPoint

func (*HexPoint) Add

func (h *HexPoint) Add(p HexPoint) HexPoint

func (HexPoint) Q

func (h HexPoint) Q() float64

func (HexPoint) R

func (h HexPoint) R() float64

func (HexPoint) S

func (h HexPoint) S() float64

func (*HexPoint) Sub

func (h *HexPoint) Sub(p HexPoint) HexPoint

type LineSquare

type LineSquare struct {
	Size   image.Rectangle
	Border uint
	Clr    color.Color
}

func (*LineSquare) At

func (ln *LineSquare) At(x int, y int) color.Color

At returns the color of the pixel at (x, y). At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid. At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right one.

func (*LineSquare) Bounds

func (ln *LineSquare) Bounds() image.Rectangle

Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0).

func (*LineSquare) ColorModel

func (ln *LineSquare) ColorModel() color.Model

ColorModel returns the Image's color model.

type Point2D

type Point2D [2]float64 // X Y

func Flat_hex_corner

func Flat_hex_corner(p Point2D, size float64, i int) Point2D

func Flat_hex_to_pixel

func Flat_hex_to_pixel(hex HexPoint, size float64) Point2D

func Pointy_hex_corner

func Pointy_hex_corner(p Point2D, size float64, i int) Point2D

func Pointy_hex_to_pixel

func Pointy_hex_to_pixel(hex HexPoint, size float64) Point2D

func (Point2D) X

func (p Point2D) X() float64

func (Point2D) Y

func (p Point2D) Y() float64

type TileMap

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

func NewTileMap

func NewTileMap(src image.Image, tXCount, tYCount uint) *TileMap

func (*TileMap) GetTile

func (tm *TileMap) GetTile(index uint) image.Image

func (*TileMap) TXSize

func (tm *TileMap) TXSize() uint

func (*TileMap) TYSize

func (tm *TileMap) TYSize() uint

Jump to

Keyboard shortcuts

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