frame

package
v0.0.0-...-9314ada Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

A screen represents a complete rectangular area which presents data.

This might be a frame buffer or background image.

The screen is rendered by pasting panels on it. This is done it two stages:

- Initial creation - Rendering dynamic content

Perhaps use MapFS for storing temp files

Index

Constants

This section is empty.

Variables

View Source
var (
	GlobalPage        = Page{Title: "Album show", ImageName: "TBC"}
	GlobalPhotoList   []string
	GlobalPhotoIDChan = make(chan string, 20)
)

Functions

func FillPhotoIDChan

func FillPhotoIDChan(ctx context.Context)

Fill channels with photo ids. Keep going until context is cancelled use channel to slow down the process Once album is exhausted it restarts at the begining

func GetClient

func GetClient() (*api.ClientWithResponses, error)

func GetImage

func GetImage(ctx context.Context) (image.Image, error)

Returns a raw image, orientated correctly but not scaled

func GetPhotoList

func GetPhotoList(ctx context.Context) ([]string, error)

Search for first album then search for first 10 pictures in that album then retrun that as a list

func NewImage

func NewImage(ctx context.Context, bounds image.Rectangle) (image.Image, error)

func NewPhotoPrism

func NewPhotoPrism(ctx context.Context) (err error)

Setup pictures to pull

func ScaleImage

func ScaleImage(img image.Image, dstBounds image.Rectangle, fit bool) image.Image

Scale and image to centre and fit or fill

Types

type Page

type Page struct {
	Title      string
	ImageName  string
	Body       []byte
	Clock      string
	PhotoIndex int
	Client     *api.ClientWithResponses
}

type Panelled

type Panelled interface {
	Render(buffer *image.RGBA)
}

type PictureFrame

type PictureFrame struct {
	// config
	Bounds image.Rectangle

	Buffer   *image.RGBA // This is what is output to the screen via the frame buffer
	BGColour color.RGBA

	CropPoint image.Point
	// contains filtered or unexported fields
}

This is the structure which holds the screen data.

func NewPictureFrame

func NewPictureFrame(bounds image.Rectangle) *PictureFrame

Create a new picture frame at a defined size, eg defined by browser window for frame size

func (*PictureFrame) AddPanel

func (pf *PictureFrame) AddPanel(panel Panelled) error

func (*PictureFrame) RenderPanels

func (pf *PictureFrame) RenderPanels() error

Calls all the child panels to rerender them

func (*PictureFrame) RenderPhotoPrism

func (pf *PictureFrame) RenderPhotoPrism() error

Get latest picture and render

func (*PictureFrame) RepaintBackground

func (pf *PictureFrame) RepaintBackground()

func (*PictureFrame) SetBGColour

func (pf *PictureFrame) SetBGColour(r, g, b uint8)

func (*PictureFrame) SetupBoundedStaticImage

func (pf *PictureFrame) SetupBoundedStaticImage()

func (*PictureFrame) SetupFullPhotoPrism

func (pf *PictureFrame) SetupFullPhotoPrism() (err error)

Setup pictures to pull

func (*PictureFrame) SetupFullStaticImage

func (pf *PictureFrame) SetupFullStaticImage()

Jump to

Keyboard shortcuts

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