imagescreen

package
v0.0.0-...-c4bb79f Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package imagescreen implements a fake screen (actually, an image) that can be used for testing the tilegraphics package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBufferSizeMismatch is returned when the size of the buffer passed to
	// FillRectangleWithBuffer doesn't match the to-be-updated area.
	ErrBufferSizeMismatch = errors.New("imagescreen: buffer size did not match width*height")
)

Functions

This section is empty.

Types

type Screen

type Screen struct {
	*image.RGBA
}

Screen is a wrapper around an image, to implement the tilegraphics Displayer interface. It is used for testing.

func NewScreen

func NewScreen(width, height int16) *Screen

NewScreen returns an in-memory memory buffer that acts as a screen, implementing the Displayer interface.

func (*Screen) Display

func (s *Screen) Display() error

Display implements the Displayer interface but is a no-op: data is stored directly to the image.

func (*Screen) FillRectangle

func (s *Screen) FillRectangle(x, y, width, height int16, c color.RGBA) error

FillRectangle fills the given rectangle with the given color.

func (*Screen) FillRectangleWithBuffer

func (s *Screen) FillRectangleWithBuffer(x, y, width, height int16, buffer []color.RGBA) error

FillRectangleWithBuffer fills the given rectangle with a slice of colors. The buffer must be in row major order.

func (*Screen) Size

func (s *Screen) Size() (int16, int16)

Size returns the width and height of this screen.

Jump to

Keyboard shortcuts

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