image

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SpectrumPalette added in v0.3.0

func SpectrumPalette() []color.Color

Types

type Colour

type Colour struct {
	// ATTR is the original colour byte. Its bit numbers are:
	// -   7: FLASH flag
	// -   6: BRIGHT flag
	// - 3-5: PAPER colour
	// - 0-2: INK colour
	// INK/PAPER colour values range from 0-7
	ATTR uint8

	// IsPixel: indicates that the INK colour should be used
	IsPixel bool

	// UseFlashColour will output RGBA colour with the ink/paper swapped,
	// but only if the FLASH bit is also set
	UseFlashColour bool
}

Colour represents a Spectrum pixel/attribute as an RGB colour value, and implements the Go color.Color interface.

func (Colour) RGBA

func (c Colour) RGBA() (r, g, b, a uint32)

RGBA returns the RGBA colours, and respects the Go color.Color interface.

type Image

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

Image is a ZX Spectrum compatible image implementation, which can be used with the standard Go image.Image interface: At(), Bounds(), ColorModel().

func FromSCR

func FromSCR(file io.Reader, opts options.Options) (*Image, error)

FromSCR a ZX Spectrum SCR to an Image representation.

func New

func New(opts options.Options) Image

New returns a new image with the given options.

func (*Image) At

func (img *Image) At(x, y int) color.Color

At returns the color of the pixel at the x/y coordinate.

func (*Image) Bounds

func (img *Image) Bounds() image.Rectangle

Bounds returns the domain for which At can return non-zero color.

func (*Image) ColorModel

func (img *Image) ColorModel() color.Model

ColorModel returns the image's color model U.S. English spelling used to match the image.Image interface

func (*Image) HasFlashingPixels added in v0.3.0

func (img *Image) HasFlashingPixels() bool

HasFlashingPixels returns true when the image has at least one pixel with the FLASH bit set.

func (*Image) Set

func (img *Image) Set(x, y int, c Colour)

Set the colour at the x/y coordinate, applying the borders and any scaling.

func (*Image) SetFlashOutput

func (img *Image) SetFlashOutput(flash bool)

SetFlashOutput will output an image with all FLASH colours on.

Jump to

Keyboard shortcuts

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