gfx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Black = iota
	White
	Red
	Cyan
	Purple
	Green
	Blue
	Yellow
	Orange
	Brown
	LightRed
	DarkGrey
	MediumGrey
	LightGreen
	LightBlue
	LightGrey
)

Color index names

Variables

View Source
var (
	Colodore = palette("000000:ffffff:813338:75cec8:8e3c97:56ac4d:2e2c9b:edf171:8e5029:553800:c46c71:4a4a4a:7b7b7b:a9ff9f:706deb:b2b2b2")
	Pepto    = palette("000000:ffffff:68372b:70a4b2:6f3d86:588d43:352879:b8c76f:6f4f25:433900:9a6759:444444:6c6c6c:9ad284:6c5eb5:959595")
	Levy     = palette("040204:fcfefc:cc3634:84f2dc:cc5ac4:5cce34:4436cc:f4ee5c:d47e34:945e34:fc9a94:5c5a5c:8c8e8c:9cfe9c:74a2ec:c4c2c4")
	Vice     = palette("000000:fdfefc:be1a24:30e6c6:b41ae2:1fd21e:211bae:dff60a:b84104:6a3304:fe4a57:424540:70746f:59fe59:5f53fe:a4a7a2")
	ViceOld  = palette("000000:d5d5d5:72352c:659fa6:733a91:568d35:2e237d:aeb75e:774f1e:4b3c00:9c635a:474747:6b6b6b:8fc271:675db6:8f8f8f")
	ViceNew  = palette("000000:ffffff:b85438:8decff:ba56e4:79d949:553ee5:fbff79:bd7c1b:7e6400:f29580:6f716e:a2a4a1:cdff9d:a18aff:d3d5d2")
)

Palettes each consisting of an array of 16 Color values

Functions

func Matching

func Matching(colors []color.Color) []color.Color

Types

type Image

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

Image represents a complete picture converted from a PNG image

func HiresImage

func HiresImage(filename string, bgColor byte) *Image

HiresImage reads an image from a PNG file and returns a Image pointer

func MulticolorImage

func MulticolorImage(filename string, bgColor byte) *Image

MulticolorImage reads an image from a PNG file and returns a Image pointer

func NewImage

func NewImage(filename string, mcol bool, bgColor byte) *Image

NewImage reads an image from a PNG file and returns a Image pointer

func (*Image) HiresByte

func (image *Image) HiresByte(x, y, c int) byte

func (*Image) Koala

func (image *Image) Koala(xoffset, yoffset int) *Koala

Koala extracts a full-screen 160x200 multicolor image in Koala format

func (*Image) MulticolorCell

func (image *Image) MulticolorCell(xoffset, yoffset int) ([]byte, error)

MulticolorCell extracts a 4x8 pixels multicolor cell as a 10-byte array, the first 8 bytes are bitmap data, followed by a screen byte and a colmap byte

func (*Image) MulticolorSprite

func (image *Image) MulticolorSprite(xoffset, yoffset int, colors []byte) []byte

MulticolorSprite extracts a multicolor sprite as a 64-byte array

func (*Image) PixelAt

func (image *Image) PixelAt(x, y int) byte

func (*Image) Pixels

func (image *Image) Pixels(xoffset, yoffset, width, height int) [][]byte

Pixels return an array of multicolor pixels (color indices) from the given area in the Image

type Koala

type Koala struct {
	Bitmap  []byte
	Screen  []byte
	Colmap  []byte
	BgColor byte
}

Koala represents a full-screen image in KoalaPainter format

func KoalaImage

func KoalaImage(filename string, bgColor byte) *Koala

KoalaImage reads an image from a PNG file and returns a Koala pointer

func (*Koala) Bytes

func (koala *Koala) Bytes(align bool) []byte

Bytes returns Koala format as raw bytes. If align is false, there will be no padding between data segments. If align is true, screen and color map data will be aligned to 1024 bytes offsets.

Jump to

Keyboard shortcuts

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