draw3

package
v0.0.0-...-e7248a3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const AspectRatio = 2.0 // dy / dx

Variables

View Source
var (
	ColorTransparent = color.Transparent
	ColorWhite       = color.White
	ColorBlack       = color.Black

	DefaultColorBG = color.Transparent
	DefaultColorFG = color.Black
)
View Source
var DrawGreedEnable = false

Functions

func DrawDigits

func DrawDigits(c *gg.Context, dd DigitDrawer,
	digitSize, stride geom.Point2f, digits []int)

func DrawDigits2D

func DrawDigits2D(c *gg.Context, dd DigitDrawer,
	digitSize, stride geom.Point2f, d2d *Digits2D)

func DrawGreedGG

func DrawGreedGG(c *gg.Context, nx, ny int, greedWidth float64)

func ImageEncodePNG

func ImageEncodePNG(m image.Image) ([]byte, error)

func ImageSavePNG

func ImageSavePNG(m image.Image, filename string) error

func MakeDigitsImage

func MakeDigitsImage(dic DigitsImageConfig, digits []int) (image.Image, error)

func MakeDigitsImage2D

func MakeDigitsImage2D(dic DigitsImageConfig, d2d *Digits2D) (image.Image, error)

func RandDigits

func RandDigits(r *random.Rand, n int) []int

func RandTrit

func RandTrit(r *random.Rand) int

func StrideHalfX

func StrideHalfX(digitSize geom.Point2f) geom.Point2f

Types

type Coord

type Coord = geom.Coord

type DigitDrawer

type DigitDrawer interface {
	DrawDigit(c *gg.Context, b geom.Bounds, digit int)
}

type DigitDrawer1

type DigitDrawer1 struct{}

func (DigitDrawer1) DrawDigit

func (DigitDrawer1) DrawDigit(c *gg.Context, b geom.Bounds, digit int)

type DigitDrawer2

type DigitDrawer2 struct{}

func (DigitDrawer2) DrawDigit

func (DigitDrawer2) DrawDigit(c *gg.Context, b geom.Bounds, digit int)

type DigitDrawer3

type DigitDrawer3 struct{}

func (DigitDrawer3) DrawDigit

func (DigitDrawer3) DrawDigit(c *gg.Context, b geom.Bounds, digit int)

type DigitDrawer4

type DigitDrawer4 struct{}

func (DigitDrawer4) DrawDigit

func (DigitDrawer4) DrawDigit(c *gg.Context, b geom.Bounds, digit int)

type DigitDrawer5

type DigitDrawer5 struct{}

func (DigitDrawer5) DrawDigit

func (DigitDrawer5) DrawDigit(c *gg.Context, b geom.Bounds, digit int)

type DigitDrawer6

type DigitDrawer6 struct{}

func (DigitDrawer6) DrawDigit

func (DigitDrawer6) DrawDigit(c *gg.Context, b geom.Bounds, digit int)

type DigitDrawer7

type DigitDrawer7 struct{}

func (DigitDrawer7) DrawDigit

func (DigitDrawer7) DrawDigit(c *gg.Context, b geom.Bounds, digit int)

type Digits2D

type Digits2D = geom.Matrix2D[int]

func NewDigits2D

func NewDigits2D(size Coord) *Digits2D

func RandDigits2D

func RandDigits2D(r *random.Rand, nX, nY int) *Digits2D

type DigitsImageConfig

type DigitsImageConfig struct {
	ColorBG     color.Color
	ColorFG     color.Color
	DigitDrawer DigitDrawer
	DigitSize   geom.Point2f
	Stride      geom.Point2f
}

type GG_Context

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

func NewGG_Context

func NewGG_Context(c *gg.Context) *GG_Context

func (*GG_Context) SetFontSize

func (p *GG_Context) SetFontSize(fontSize float64) error

func (*GG_Context) SetFontSizeFactor

func (p *GG_Context) SetFontSizeFactor(dX, dY float64, fontSizeFactor float64) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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