Documentation ¶
Overview ¶
Package img1b is a fork of the standard Go image package modified for 1-bit images. Images are kept packed so they take up to 8 times less memory and may be processed faster.
There is currently no img1b.Decode. To read a PNG file use Decode from img1b/png.
Index ¶
- type Image
- func (p *Image) At(x, y int) color.Color
- func (p *Image) Bounds() image.Rectangle
- func (p *Image) ColorIndexAt(x, y int) uint8
- func (p *Image) ColorModel() color.Model
- func (p *Image) Opaque() bool
- func (p *Image) PixBitOffset(x, y int) (ofs, bit int)
- func (p *Image) SetColorIndex(x, y int, index uint8)
- func (p *Image) SubImage(r image.Rectangle) *Image
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Image ¶
type Image struct { // Pix is a bitmap of image pixels. Bytes represent up to 8 horizontally adjacent // pixels (there may be unused bits in the last byte of a row) with the most // significant bit corresponding to leftmost pixel. Pix []byte // Stride is the Pix stride (in bytes) between vertically adjacent pixels. Stride int // Rect is the image's bounds. Rect image.Rectangle // Palette is the image's palette. Palette color.Palette }
Image implements the image.PalettedImage interface and is mostly analogous to image.Paletted except that Pix is a bitmap, so only color indices 0 and 1 can be used.
func (*Image) Bounds ¶
Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0).
func (*Image) ColorIndexAt ¶
ColorIndexAt returns the palette index of the pixel at (x, y).
func (*Image) ColorModel ¶
ColorModel returns the Image's color model.
func (*Image) PixBitOffset ¶
PixBitOffset returns the index of the byte of Pix that corresponds to the pixel at (x, y) and bit offset (7 for MSB) in that byte.
func (*Image) SetColorIndex ¶
SetColorIndex sets color index for the pixel at (x, y). Index should be 0 or 1.