splashframe

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package splashframe is the boot splash's frame as both sides of the hand-over to the greeter compute it: the grid every splash state sits on, the logo and where it goes, and the record of the splash's last frame that the greeter reproduces as its first.

Index

Constants

View Source
const (
	// LogoPx is the side of the lys logo.
	LogoPx = 112
	// IndicatorPx is the side of the throbber and of the lock over a
	// prompt.
	IndicatorPx = 40
	// EntryPx is the width of the prompt's field and of the progress bar.
	EntryPx = 320
)

The fixed sizes of the grid at scale 1, in pixels.

View Source
const BGRTDir = "/sys/firmware/acpi/bgrt"

BGRTDir is where Linux exposes the ACPI BGRT table.

View Source
const LastFramePath = "/run/lys-splash/last-frame.json"

LastFramePath is where a splash that hands its screen over records its last frame, for as long as it runs.

Variables

This section is empty.

Functions

func FormatColor

func FormatColor(c render.Color) string

FormatColor is c as #rrggbb.

func LysLogo(frame image.Point, scale int) image.Rectangle

LysLogo is where the lys logo goes on a frame at scale: at the optical centre when the status group fits below it there, otherwise centred with the group as one block, so a short frame holds every row.

func OpticalOrigin

func OpticalOrigin(frame, size image.Point) image.Point

OpticalOrigin is the top left corner of a box of size centred across a frame and at the golden ratio of its height, as plymouth places a logo.

func ParseColor

func ParseColor(s string) (render.Color, error)

ParseColor reads an opaque #rrggbb color.

func RasterizeLogo(scale int, c render.Color) (*render.Icon, error)

RasterizeLogo draws the lys logo for a frame at scale, its shape in c: milliseconds of work, so a frame loop asks for it ahead of the frame that shows it.

func SaveLastFrame

func SaveLastFrame(path string, f LastFrame) error

SaveLastFrame records f at path, replacing what was there whole.

func Space

func Space(r tokens.Rem, scale int) int

Space is the spacing token r in pixels at scale.

Types

type BGRT

type BGRT struct {
	Image  image.Image
	Offset image.Point
}

BGRT is the logo the firmware left on screen: its image and where the firmware drew it, in the firmware's own pixels.

func LoadBGRT

func LoadBGRT(dir string) (*BGRT, error)

LoadBGRT reads the firmware's logo from dir. A machine without a BGRT table, or one whose status says the logo is no longer on screen, has none: nil and no error.

func (*BGRT) Mark

func (b *BGRT) Mark(frame image.Point) Mark

Mark is the firmware's logo placed on a frame.

func (*BGRT) Rect

func (b *BGRT) Rect(frame image.Point) image.Rectangle

Rect is where the firmware logo goes on a frame: at the firmware's offsets when they centre it horizontally on this frame, which means the firmware drew at this resolution, otherwise at the optical centre as plymouth places it.

type Grid

type Grid struct {
	Scale int

Grid is where everything on a splash frame goes, in device pixels: the logo, and below it the status group of fixed rows that every state fills, so moving between states never moves anything.

func Layout

func Layout(frame image.Point, scale int, logo image.Rectangle) Grid

Layout is the grid of a frame at scale with the logo in the box logo: the status group starts below it. LysLogo leaves room for the group; a logo the firmware placed may not, and the group then moves up, never over the logo, and when that is not enough closes the gaps between its rows.

func (Grid) Translated

func (g Grid) Translated(d image.Point) Grid

Translated is the grid moved by d, for drawing part of a frame into a buffer of its own.

type LastFrame

type LastFrame struct {
	Background    render.Color
	LogoColor     render.Color
	ReducedMotion bool
	Outputs       []Output
}

LastFrame is the splash's last frame as the greeter reproduces it: the background and logo of its Picture on every output, the colour the lys logo is drawn in, and whether the splash's theme asked for cuts instead of fades.

func LoadLastFrame

func LoadLastFrame(path string) (LastFrame, error)

LoadLastFrame reads the record at path; with no splash handing over there is none, and the error is fs.ErrNotExist.

func ParseLastFrame

func ParseLastFrame(data []byte) (LastFrame, error)

ParseLastFrame reads a record Encode wrote: every field present and valid, and at least one output.

func (LastFrame) Encode

func (f LastFrame) Encode() ([]byte, error)

Encode is f as the record LoadLastFrame reads.

func (LastFrame) Named

func (f LastFrame) Named(name string) (Output, error)

Named is the output the splash drew on under the connector name, an error naming the outputs it did draw on when there is none.

type Logo uint8

Logo is which logo a splash frame shows.

const (
	// LogoLys is the lys logo.
	LogoLys Logo = iota
	// LogoFirmware is the firmware's logo from the ACPI BGRT table.
	LogoFirmware
)

type Mark

type Mark struct {
	Image image.Image
	At    image.Rectangle
}

Mark is a logo raster and the box it fills, in device pixels.

func LysMark

func LysMark(frame image.Point, scale int, logo *render.Icon) Mark

LysMark is the lys logo rasterized at scale, placed on a frame.

func (Mark) Paint

func (m Mark) Paint(cv *render.Canvas)

Paint blends the logo onto cv, one raster pixel to one device pixel.

type Output

type Output struct {
	Name  string
	Size  image.Point
	Scale int
}

Output is one output the splash drew its last frame on: its connector, the frame's size in device pixels and the scale the grid had there.

type Picture

type Picture struct {
	Background render.Color
	Mark       Mark
}

Picture is what the splash's last frame shows once its status group has gone: the logo alone on the background.

func (Picture) Paint

func (p Picture) Paint(cv *render.Canvas)

Paint fills cv's clip with the picture.

Jump to

Keyboard shortcuts

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