Documentation
¶
Overview ¶
Package display defines device-independent monochrome frame and lifecycle contracts. Frames borrow caller-owned storage and never allocate or copy it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrCapabilities = errors.New("display: invalid capabilities") ErrColor = errors.New("display: invalid color") ErrFrameGeometry = errors.New("display: invalid frame geometry") ErrPixelBounds = errors.New("display: pixel outside frame") ErrRefreshMode = errors.New("display: unsupported refresh mode") )
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct {
Size Size
ColorModel ColorModel
RefreshModes RefreshMode
WidthAlignment int
HeightAlignment int
StrideAlignment int
RefreshAutoSleeps bool
}
Capabilities describes the logical frame and lifecycle accepted by a Device.
func (Capabilities) FrameStride ¶
func (c Capabilities) FrameStride() (int, error)
FrameStride returns the one packed row stride accepted by the device.
func (Capabilities) Validate ¶
func (c Capabilities) Validate() error
Validate reports whether the capabilities form a usable monochrome contract.
func (Capabilities) ValidateFrame ¶
func (c Capabilities) ValidateFrame(frame Frame, mode RefreshMode) error
ValidateFrame verifies that frame and mode can be consumed by the device.
type Color ¶
type Color uint8
Color is a monochrome pixel value. Packed frames use zero for white and one for black, with the leftmost pixel in the most-significant bit.
type ColorModel ¶
type ColorModel uint8
ColorModel identifies a frame's pixel representation.
const (
Mono1 ColorModel = 1 + iota
)
type Device ¶
type Device interface {
Capabilities() Capabilities
Refresh(frame Frame, mode RefreshMode) error
Sleep() error
}
Device consumes complete frames synchronously. Refresh must not retain or mutate frame storage after it returns. Sleep is idempotent.
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame is a mutable view over caller-owned packed monochrome storage. Copies of Frame share the same bytes. The storage must remain stable while Refresh is running and may be reused as soon as Refresh returns.
func (Frame) Bytes ¶
Bytes returns the borrowed backing storage. Callers must follow Frame's ownership rules and must not resize the slice.
type RefreshMode ¶
type RefreshMode uint8
RefreshMode is both a single refresh request and a capabilities bit.
const ( RefreshFull RefreshMode = 1 << iota RefreshPartial )