artwork

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 14 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 artwork decodes covers and derives the color and low-resolution backdrop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blur

func Blur(img image.Image) *image.RGBA

blurImage returns img shrunk and blurred, more saturated, to fill a backdrop behind what plays, scaled up as smooth as it is.

func Decode

func Decode(b []byte) (image.Image, error)

func DecodeBitmap

func DecodeBitmap(b []byte) (*ui.Bitmap, image.Image, error)

func DominantColor

func DominantColor(img image.Image) ui.Color

dominantColor returns the most vivid color that covers much of img: the hue that its saturated pixels share most, at their mean.

func HSV

func HSV(r, g, b float64) (h, s, v float64)

func Still

func Still(b []byte) []byte

Still returns the data of a cover that the decoders read. Some covers are animated WebP, whatever their name says, which they cannot: those show their first frame.

Types

type Cache

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

Cache loads covers on goroutines and keeps them, up to artLimit bytes: their pixels on the GPU while they show, and on the CPU only their data, which takes a fraction of the pixels. Its methods run on the main thread; post runs a function there.

func NewCache

func NewCache(post func(func())) *Cache

func (*Cache) Get

func (c *Cache) Get(cacheKey, url string, backdrop bool) *CachedImage

get returns the cover under cacheKey, or nil while it loads from url.

func (*Cache) SetFetcher

func (c *Cache) SetFetcher(fetch func() func(string) ([]byte, error), generation func() uint64)

SetFetcher captures a provider-specific fetcher for each new request. generation identifies the active provider when the result is applied.

type CachedImage

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

CachedImage is a cover, decoded and ready to draw, with what the player derives from it: its color, and a blurred copy to fill a backdrop.

func (*CachedImage) Bitmap

func (art *CachedImage) Bitmap() *ui.Bitmap

func (*CachedImage) Blurred

func (art *CachedImage) Blurred() *ui.Bitmap

func (*CachedImage) Failed

func (art *CachedImage) Failed() bool

func (*CachedImage) Tint

func (art *CachedImage) Tint() ui.Color

Jump to

Keyboard shortcuts

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