webdisplay

package module
v0.0.0-...-584c450 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

README

HTTP display implementation for periph.io

Go Reference

A display drawer/driver for the periph.io ecosystem sending updates to the graphics buffer to clients.

Images are encoded using the PNG format and sent as multipart/x-mixed-replace fragments. JPEG is also supported (see Motion JPEG (MJPEG)).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drawer

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

func New

func New(opt Options) *Drawer

New creates a new web display instance.

func (*Drawer) Bounds

func (d *Drawer) Bounds() image.Rectangle

Bounds implements image.Image.

func (*Drawer) ColorModel

func (d *Drawer) ColorModel() color.Model

ColorModel implements image.Image.

func (*Drawer) Draw

func (d *Drawer) Draw(dstRect image.Rectangle, src image.Image, srcPts image.Point) error

Draw implements draw.Image.

func (*Drawer) Halt

func (d *Drawer) Halt() error

Halt implements conn.Resource and terminates all running client requests asynchronously.

func (*Drawer) ServeHTTP

func (d *Drawer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles HTTP GET requests and sends a stream of images representing the display buffer in response. The display options control the default format and clients can explicitly request PNG or JPEG images using the "format" parameter ("?format=png", "?format=jpeg").

func (*Drawer) String

func (d *Drawer) String() string

type ImageFormat

type ImageFormat int
const (
	PNG ImageFormat = iota
	JPEG

	DefaultFormat = PNG
)

func ImageFormatFromString

func ImageFormatFromString(value string) (ImageFormat, error)

func (ImageFormat) String

func (f ImageFormat) String() string

type Options

type Options struct {
	// Width and height of the image buffer.
	Width, Height int

	// Format specifies the image format to send to clients.
	Format ImageFormat
}

Jump to

Keyboard shortcuts

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