bitmap

package
v0.0.0-...-6d4d12d Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package bitmap provides a compact bitmap image type and a paletted bitmap view of another image.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bitmap

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

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

func New

func New(r image.Rectangle, off, on color.Color) *Bitmap

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

func (*Bitmap) At

func (b *Bitmap) At(x, y int) color.Color

At returns the color at a point.

func (*Bitmap) BitAt

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

BitAt returns whether the bit is set at a point.

func (*Bitmap) BitSet

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

BitSet sets or resets the bit at a point.

func (*Bitmap) Bounds

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

Bounds returns the bounds of the bitmap

func (*Bitmap) ColorModel

func (b *Bitmap) ColorModel() color.Model

ColorModel returns the bitmap's palette.

func (*Bitmap) Set

func (b *Bitmap) Set(x, y int, c color.Color)

Set sets the color at a point.

type PalettedBitmap

type PalettedBitmap struct {
	Image   image.Image
	Palette color.Palette
}

PalettedBitmap is a view of another image, rendered down to the nearest of two colors.

func NewPaletted

func NewPaletted(img image.Image, off, on color.Color) *PalettedBitmap

NewPaletted adapts an arbitrary image to a readable bitmap based on a two-color palette.

func (*PalettedBitmap) BitAt

func (p *PalettedBitmap) BitAt(x, y int) bool

BitAt returns whether the bit at a point more closely resembles the "on" color in the palette.

func (*PalettedBitmap) Bounds

func (p *PalettedBitmap) Bounds() image.Rectangle

Bounds returns the bounds of the underlying image.

Jump to

Keyboard shortcuts

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