pixelflut

package
v0.0.0-...-2c3af24 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2022 License: BSD-3-Clause Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	LeftToRight = 0b000
	TopToBottom = 0b001
	RightToLeft = 0b010
	BottomToTop = 0b011
	Shuffle     = 0b100
)

Variables

View Source
var PerformanceReporter = initPerfReporter()

PerformanceReporter provides pixelflut performance metrics, when Enabled is true.

@speed: Note that enabling  costs ~9% bomb performance under high throughput.

Functions

func CanvasSize

func CanvasSize(address string) (int, int)

CanvasSize returns the size of the canvas as returned by the server

func FetchImage

func FetchImage(bounds *image.Rectangle, address string, conns int, stop chan bool) (img *image.NRGBA)

FetchImage asynchronously uses `conns` to fetch pixels within `bounds` from a pixelflut server at `address`, and writes them into the returned Image. If bounds is nil, the server's entire canvas is fetched.

func Flut

func Flut(t FlutTask, stop chan bool, wg *sync.WaitGroup)

Flut asynchronously executes the given FlutTask, until `stop` is closed.

func OffsetCmd

func OffsetCmd(x, y int) []byte

OffsetCmd applies offset to all following requests. Not supported by all servers. example: https://github.com/TobleMiner/shoreline.

Types

type FlutTask

type FlutTask struct {
	FlutTaskOpts
	Img FlutTaskData
}

FlutTask contains all data that is needed to flut

func (FlutTask) IsFlutable

func (t FlutTask) IsFlutable() bool

IsFlutable indicates if a task is properly initialized & not paused

func (FlutTask) String

func (t FlutTask) String() string

type FlutTaskData

type FlutTaskData = *image.NRGBA

FlutTaskData contains the actual pixeldata to flut, separated because of size

type FlutTaskOpts

type FlutTaskOpts struct {
	Address     string
	MaxConns    int
	Offset      image.Point
	Paused      bool
	RGBSplit    bool // @cleanup: replace with `FX: []Effect`
	RandOffset  bool
	RenderOrder RenderOrder
}

FlutTaskOpts specifies parameters of the flut

type Performance

type Performance struct {
	Enabled     bool
	Conns       int
	BytesPerSec int
	BytesTotal  int
	// contains filtered or unexported fields
}

Performance contains pixelflut metrics

func (Performance) String

func (p Performance) String() string

type RenderOrder

type RenderOrder uint8

func NewOrder

func NewOrder(v string) RenderOrder

func (RenderOrder) IsReverse

func (t RenderOrder) IsReverse() bool

func (RenderOrder) IsVertical

func (t RenderOrder) IsVertical() bool

func (RenderOrder) String

func (t RenderOrder) String() string

Jump to

Keyboard shortcuts

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