painter

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

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

Go to latest
Published: Apr 16, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UpdateOp = updateOp{}

UpdateOp операція, яка не змінює текстуру, але сигналізує, що текстуру потрібно розглядати як готову.

Functions

func GreenFill

func GreenFill(t screen.Texture)

GreenFill зафарбовує тестуру у зелений колір. Може бути викоистана як Operation через OperationFunc(GreenFill).

func WhiteFill

func WhiteFill(t screen.Texture)

TODO: GreenFill and WhiteFill are unnecessary WhiteFill зафарбовує тестуру у білий колір. Може бути викоистана як Operation через OperationFunc(WhiteFill).

Types

type FigureRect

type FigureRect struct {
	X0 int
	Y0 int
	X1 int
	Y1 int
}

type FigureT

type FigureT struct {
	X int
	Y int
}

type Loop

type Loop struct {
	Receiver Receiver
	// contains filtered or unexported fields
}

Loop реалізує цикл подій для формування текстури отриманої через виконання операцій отриманих з внутрішньої черги.

func (*Loop) Post

func (l *Loop) Post(op Operation)

Post додає нову операцію у внутрішню чергу.

func (*Loop) Start

func (l *Loop) Start(s screen.Screen)

Start запускає цикл подій. Цей метод потрібно запустити до того, як викликати на ньому будь-які інші методи.

func (*Loop) StopAndWait

func (l *Loop) StopAndWait()

StopAndWait сигналізує про необхідність завершити цикл та блокується до моменту його повної зупинки.

type Operation

type Operation interface {
	// Do виконує зміну операції, повертаючи true, якщо текстура вважається готовою для відображення.
	Do(t screen.Texture) (ready bool)
}

Operation змінює вхідну текстуру.

func MakeBgRectOp

func MakeBgRectOp(state *State, x0, y0, x1, y1 float32) Operation

func MakeFigureOp

func MakeFigureOp(state *State, x, y float32) Operation

func MakeGreenFillOp

func MakeGreenFillOp(state *State) Operation

func MakeMoveOp

func MakeMoveOp(state *State, x, y float32) Operation

func MakeResetOp

func MakeResetOp(state *State) Operation

func MakeWhiteFillOp

func MakeWhiteFillOp(state *State) Operation

type OperationFunc

type OperationFunc func(t screen.Texture)

OperationFunc використовується для перетворення функції оновлення текстури в Operation.

func (OperationFunc) Do

func (f OperationFunc) Do(t screen.Texture) bool

type OperationList

type OperationList []Operation

OperationList групує список операції в одну.

func (OperationList) Do

func (ol OperationList) Do(t screen.Texture) (ready bool)

type Receiver

type Receiver interface {
	Update(t screen.Texture)
}

Receiver отримує текстуру, яка була підготовлена в результаті виконання команд у циклі подій.

type State

type State struct {
	BackgroundColor color.Color
	BgRect          *FigureRect
	Figures         []FigureT
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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