image

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package image implements a bitmap image type, and a binary color type

Index

Constants

This section is empty.

Variables

View Source
var BinaryColorModel color.Model = color.ModelFunc(toBinaryColor)

The ColorModel associated with BinaryColor.

Functions

This section is empty.

Types

type BinaryColor

type BinaryColor struct {
	Black bool
}

A BinaryColor represents either black or white.

func (BinaryColor) RGBA

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

type Bitmap

type Bitmap struct {
	// Pix holds the image's pixels. The pixel at (x, y) is Pix[y*Stride + x/8] >> (7 - x&7) & 1.
	Pix    []uint8
	Stride int
	// Rect is the image's bounds.
	Rect i.Rectangle
}

A Bitmap is an in-memory image of BinaryColor values.

func NewBitmap

func NewBitmap(w, h int) *Bitmap

NewBitmap returns a new Bitmap with the given width and height.

func (*Bitmap) At

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

func (*Bitmap) Bounds

func (p *Bitmap) Bounds() i.Rectangle

func (*Bitmap) ColorModel

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

func (*Bitmap) Opaque

func (p *Bitmap) Opaque() bool

Opaque scans the entire image and returns whether or not it is fully opaque.

func (*Bitmap) Set

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

func (*Bitmap) SetBinary

func (p *Bitmap) SetBinary(x, y int, c BinaryColor)

func (*Bitmap) SubImage

func (p *Bitmap) SubImage(r i.Rectangle) i.Image

SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.

Directories

Path Synopsis
Package pnm implements a PBM image decoder.
Package pnm implements a PBM image decoder.
Package xbm implements an X11 Bitmap decoder.
Package xbm implements an X11 Bitmap decoder.

Jump to

Keyboard shortcuts

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