Documentation
¶
Overview ¶
Package fb provides frame buffer image handling.
Index ¶
- Variables
- func NewMonochromeWith(pix []byte, r image.Rectangle, stride int) (draw.Image, error)
- func NewRGB565With(pix []byte, r image.Rectangle, stride int) (draw.Image, error)
- func NewXRGBWith(pix []byte, r image.Rectangle, stride int) (draw.Image, error)
- type Monochrome
- type Pixel
- type Pixel565
- type PixelXRGB
- type RGB565
- type XRGB
Constants ¶
This section is empty.
Variables ¶
var MonochromeModel color.Model = color.ModelFunc(monoModel)
MonochromeModel is the color model for black and white images.
var RGB565Model color.Model = color.ModelFunc(rgb565Model)
RGB565Model is the color model for RGB565 images.
var XRGBModel color.Model = color.ModelFunc(xrgbModel)
XRGBModel is the color model for XRGB images.
Functions ¶
func NewMonochromeWith ¶
NewMonochromeWith returns a new Monochrome image with the given bounds and stride, backed by the []byte, pix. If stride is zero, a working stride is computed. If the length of pix is less than stride*h, an error is returned.
func NewRGB565With ¶
NewRGB565With returns a new RGB565 image with the given bounds, backed by the []byte, pix. If stride is zero, a working stride is computed. If the length of pix is less than stride*h, an error is returned.
func NewXRGBWith ¶
NewXRGBWith returns a new XRGB image with the given bounds, backed by the []byte, pix. If stride is zero, a working stride is computed. If the length of pix is less than stride*h, an error is returned.
Types ¶
type Monochrome ¶
type Monochrome struct {
// Pix holds the image's pixels, as bit values.
// The pixel at (x, y) is the x%8^th bit in
// Pix[(x-Rect.Min.X)/8 + (y-Rect.Min.Y)*Stride].
Pix []uint8
// Stride is the Pix stride (in bytes) between
// vertically adjacent pixels.
Stride int
// Rect is the image's bounds.
Rect image.Rectangle
}
Monochrome is an in-memory image whose At method returns Pixel values.
func NewMonochrome ¶
func NewMonochrome(r image.Rectangle, stride int) *Monochrome
NewMonochrome returns a new Monochrome image with the given bounds and stride. If stride is zero, a working stride is computed.
func (*Monochrome) At ¶
func (p *Monochrome) At(x, y int) color.Color
At returns the color of the pixel at (x, y).
func (*Monochrome) Bounds ¶
func (p *Monochrome) Bounds() image.Rectangle
Bounds returns the bounding rectangle for the image.
func (*Monochrome) ColorModel ¶
func (p *Monochrome) ColorModel() color.Model
ColorModel returns the monochrome color model.
type RGB565 ¶
type RGB565 struct {
// Pix holds the image's pixels, as RGB565 values.
// The Pixel565 at (x, y) is the pair of bytes at
// Pix[2*(x-Rect.Min.X) + (y-Rect.Min.Y)*Stride].
// Pixel565 values are encoded little endian in Pix.
Pix []uint8
// Stride is the Pix stride (in bytes) between
// vertically adjacent pixels.
Stride int
// Rect is the image's bounds.
Rect image.Rectangle
}
RGB565 is an in-memory image whose At method returns Pixel565 values.
func (*RGB565) ColorModel ¶
ColorModel returns the RGB565 color model.
type XRGB ¶
type XRGB struct {
// Pix holds the image's pixels, as 32 bit XRGB
// values stored in little-endian order.
// The pixel at (x, y) is the four bytes at
// Pix[4*(x-Rect.Min.X) + (y-Rect.Min.Y)*Stride].
Pix []uint8
// Stride is the Pix stride (in bytes) between
// vertically adjacent pixels.
Stride int
// Rect is the image's bounds.
Rect image.Rectangle
}
XRGB is an in-memory image whose At method returns PixelXRGB values.
func (*XRGB) ColorModel ¶
ColorModel returns the XRGB color model.