pixel

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: MIT Imports: 7 Imported by: 0

README

bitmap

Bitmap drawing.

Documentation

Overview

Package pixel contains common pixel formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Circle

func Circle(b Image, p image.Point, r int, c color.Color)

Circle draws a circle at point p with radius r.

func FadeOutDither

func FadeOutDither(buffer *Bitmap, duration time.Duration) <-chan time.Time

FadeOutDither applies gradual 4×4 Bayes dithering to all pixels off.

func Fill

func Fill(b Image, c color.Color)

func FillRectangle

func FillRectangle(b Image, r image.Rectangle, c color.Color)

FillRectangle draws a filled rectangle between the two points.

func HLine

func HLine(b Image, p image.Point, width int, c color.Color)

HLine draws a horizontal line at p with the given width.

func Line

func Line(b Image, p0, p1 image.Point, c color.Color)

Line draws a line between two points.

func Rectangle

func Rectangle(b Image, r image.Rectangle, c color.Color)

Rectangle draws a rectangle outline between the two points.

func ScrollDown

func ScrollDown(b Image)

func ScrollUp

func ScrollUp(b Image)

func VLine

func VLine(b Image, p image.Point, height int, c color.Color)

VLine draws a vertical line at p with the given height.

Types

type Bitmap

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

func NewBitmap

func NewBitmap(w, h int) *Bitmap

func (*Bitmap) At

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

func (*Bitmap) Bounds

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

func (*Bitmap) ColorModel

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

func (*Bitmap) PixOffset

func (b *Bitmap) PixOffset(x, y int) (int, uint)

func (*Bitmap) Set

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

func (*Bitmap) SetBit

func (b *Bitmap) SetBit(x, y int, c pixelcolor.Bit)

type Format

type Format int
const (
	UnknownFormat Format = iota
	MHMSBFormat
	MVLSBFormat
	RGB332Format
	RGB565Format
	RGB888Format
	RGBA4444Format
	RGBA5551Format
)

func (Format) ColorModel

func (f Format) ColorModel() color.Model

type Image

type Image interface {
	draw.Image
}

func Must

func Must(width, height int, format Format) Image

func New

func New(width, height int, format Format) (Image, error)

type RGB332

type RGB332 struct {
	Rect   image.Rectangle
	Pix    []byte
	Stride int
}

func NewRGB332

func NewRGB332(w, h int) *RGB332

func (*RGB332) At added in v0.1.3

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

func (*RGB332) Bounds added in v0.1.3

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

func (RGB332) ColorModel added in v0.1.3

func (RGB332) ColorModel() color.Model

func (*RGB332) Set added in v0.1.3

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

type RGB565

type RGB565 struct {
	Rect   image.Rectangle
	Pix    []byte
	Stride int
}

func NewRGB565

func NewRGB565(w, h int) *RGB565

func (*RGB565) At added in v0.1.3

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

func (*RGB565) Bounds added in v0.1.3

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

func (RGB565) ColorModel added in v0.1.3

func (RGB565) ColorModel() color.Model

func (*RGB565) OffsetOf added in v0.1.3

func (b *RGB565) OffsetOf(x, y int) (offset int)

func (*RGB565) Set added in v0.1.3

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

type RGB888

type RGB888 struct {
	Rect   image.Rectangle
	Pix    []byte
	Stride int
}

func NewRGB888

func NewRGB888(w, h int) *RGB888

func (*RGB888) At added in v0.1.3

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

func (*RGB888) Bounds added in v0.1.3

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

func (*RGB888) ColorModel added in v0.1.3

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

func (*RGB888) OffsetOf added in v0.1.3

func (b *RGB888) OffsetOf(x, y int) (offset int)

func (*RGB888) Set added in v0.1.3

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

type RGBA4444

type RGBA4444 struct {
	Rect   image.Rectangle
	Pix    []byte
	Stride int
}

func NewRGBA4444 added in v0.1.3

func NewRGBA4444(w, h int) *RGBA4444

func (*RGBA4444) At added in v0.1.3

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

func (*RGBA4444) Bounds added in v0.1.3

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

func (*RGBA4444) ColorModel added in v0.1.3

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

func (*RGBA4444) OffsetOf added in v0.1.3

func (b *RGBA4444) OffsetOf(x, y int) (offset int)

func (*RGBA4444) Set added in v0.1.3

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

type RGBA5551

type RGBA5551 struct {
	Rect   image.Rectangle
	Pix    []byte
	Stride int
}

func NewRGBA5551 added in v0.1.3

func NewRGBA5551(w, h int) *RGBA5551

func (*RGBA5551) At added in v0.1.3

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

func (*RGBA5551) Bounds added in v0.1.3

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

func (*RGBA5551) ColorModel added in v0.1.3

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

func (*RGBA5551) OffsetOf added in v0.1.3

func (b *RGBA5551) OffsetOf(x, y int) (offset int)

func (*RGBA5551) Set added in v0.1.3

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

Directories

Path Synopsis
Package pixelcolor contains common color formats.
Package pixelcolor contains common color formats.

Jump to

Keyboard shortcuts

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