fbdrv

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package fbdrv provides frame-buffer based drivers for pix graphics library. It is intended to be used for the displays without any internal frame buffer or for small displays with the internal frame buffer accessible via write-only communication interface. It can be also used instead of ../imgdrv to draw on any in memory image with added benefit of working SetDir and Flush methods.

The subpackages provides drivers to the specific display controllers.

Index

Constants

View Source
const (
	None  = 0
	Write = 1
)

DCI.Cmd dataMode constants.

View Source
const (
	MI = 0         // identity (no operation)
	MV = 1 << iota // swap X with Y
	MX             // mirror X axis
	MY             // mirror Y axis
)

Coordination system translation constants

Variables

This section is empty.

Functions

This section is empty.

Types

type DCI

type DCI interface {
	// Cmd writes len(p) bytes from p to the display controller using command
	// transfer mode. The dataMode parameter describes the presence of the
	// data transfer which together with p forms a complete write transaction.
	Cmd(p []byte, dataMode int)

	// WriteBytes writes len(p) bytes from p to the display controller using
	// data transfer mode.
	WriteBytes(p []uint8)

	// End ends the conversation with the display controller. The undelying
	// shared communication interface can be used by another application until
	// next command.
	End()

	// Err returns the saved error and clears it if the clear is true.
	Err(clear bool) error
}

DCI defines the Display Controller Interface. It is used by some FrameBuffer implementations to communicate with the underlying display controller, in particular to transfer the content of the local frame buffer to the display frame buffer. DCI is a subset of ../tftdrv.DCI so any tftdrv.DCI implementation should be a valid implementation of DCI.

type FrameBuffer

type FrameBuffer interface {
	// SetDir returns the frame buffer in buf and its geometry in width, height
	// and stride. In case of sub-byte pixels the bit shift to the first pixel
	// in buf[0] is provided in shift. The mvxy translation (described as
	// a combination of MV, MX, MY constants) should be aplied when drawing
	// in the returned buffer to obtain the desired direction (rotation) of the
	// image on the display. Every SetDir call may return a different buffer
	// with a different geometry and random content.
	SetDir(dir int) (buf []byte, width, height, stride int, shitf, mvxy uint8)

	// Flush exports the content of the internal RAM buffer to the actual
	// display or to an other media like file, etc. The data in buffer may be
	// also used to produce the visible image in real time. In such case Flush
	// may swap buffers if multi-buffering is implemented, sleep until the
	// beginning of the next V-blank period or simply do nothing. Flush returns
	// a buffer which should be used for subsequent drawing operations. The
	// returned buffer may contain random data (BUG: really so?).
	Flush() (buf []byte)

	// Err returns the saved error and clears it if the clear is true.
	Err(clear bool) error
}

FrameBuffer defines the interface to an in RAM frame buffer.

type Mono

type Mono struct {
	// contains filtered or unexported fields
}

func NewMono

func NewMono(fb FrameBuffer) *Mono

func (*Mono) Draw

func (d *Mono) Draw(r image.Rectangle, src image.Image, sp image.Point, mask image.Image, mp image.Point, op draw.Op)

func (*Mono) Err

func (d *Mono) Err(clear bool) error

func (*Mono) Fill

func (d *Mono) Fill(r image.Rectangle)

func (*Mono) Flush

func (d *Mono) Flush()

func (*Mono) SetColor

func (d *Mono) SetColor(c color.Color)

func (*Mono) SetDir

func (d *Mono) SetDir(dir int) image.Rectangle

type RGB

type RGB struct {
	// contains filtered or unexported fields
}

func NewRGB

func NewRGB(fb FrameBuffer) *RGB

func (*RGB) Draw

func (d *RGB) Draw(r image.Rectangle, src image.Image, sp image.Point, mask image.Image, mp image.Point, op draw.Op)

func (*RGB) Err

func (d *RGB) Err(clear bool) error

func (*RGB) Fill

func (d *RGB) Fill(r image.Rectangle)

func (*RGB) Flush

func (d *RGB) Flush()

func (*RGB) SetColor

func (d *RGB) SetColor(c color.Color)

func (*RGB) SetDir

func (d *RGB) SetDir(dir int) image.Rectangle

Directories

Path Synopsis
Package ssd1306 provides driver to SSD1306 based displays.
Package ssd1306 provides driver to SSD1306 based displays.

Jump to

Keyboard shortcuts

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