bitmap

package
v0.0.0-...-e2c65c2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToImage

func ToImage(b *Bitmap, on, off color.Color) image.Image

ToImage produces a view of a bitmap with colors corresonding to on and off bits.

Types

type Bitmap

type Bitmap struct {
	Bytes  []byte
	Stride int
	Rect   image.Rectangle
}

Bitmap is a compact bitmap image with a two-color palette.

func New

func New(r image.Rectangle) *Bitmap

New returns a bitmap with the given rectangle and two-color palette.

func (*Bitmap) At

func (b *Bitmap) At(x, y int) bool

At returns whether the bit is set at a point.

func (*Bitmap) Bounds

func (b *Bitmap) Bounds() image.Rectangle

Bounds returns the bounds of the bitmap

func (*Bitmap) Set

func (b *Bitmap) Set(x, y int, bit bool)

Set sets or resets the bit at a point.

type Reader

type Reader interface {
	At(x, y int) bool
	Bounds() image.Rectangle
}

Reader is a view into a bitmap.

func FromImage

func FromImage(i image.Image, on, off color.Color) Reader

FromImage produces a bitmap view of an image, where bits are on or off depending on whether they more closely match the on or off color.

type ReaderWriter

type ReaderWriter interface {
	At(x, y int) bool
	Set(x, y int, b bool)
	Bounds() image.Rectangle
}

ReaderWriter is a readable/writable view into a bitmap.

type Writer

type Writer interface {
	Set(x, y int, b bool)
	Bounds() image.Rectangle
}

Writer is a writable view into a bitmap.

Jump to

Keyboard shortcuts

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