imagegen

package
v0.0.0-...-3170865 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ratio = 2
	W     = 540 * Ratio
	H     = 960 * Ratio
	//BarColor        = "#B4F8C8"
	//BackgroundColor = "#000000"
	IconColor       = "#FFF"
	BarColor        = "#FCA311"
	BackgroundColor = "#14213D"
	TitleFontSize   = 48 * Ratio
	BoldFontSize    = 20 * Ratio
	RegularFontSize = 14 * Ratio
)
View Source
const (
	QueryMostPlayedConsoles = `` /* 270-byte string literal not displayed */

	QueryMostPlayedPlatforms = `` /* 359-byte string literal not displayed */

	QueryMostPlayedGames = `` /* 475-byte string literal not displayed */

	QueryMostPlayedSeries = `` /* 346-byte string literal not displayed */

	QueryGamesByStatus = `` /* 224-byte string literal not displayed */

	QueryBusiestMonths = `` /* 391-byte string literal not displayed */

)
View Source
const (
	AssetsFolder = "./assets/"
)

Variables

This section is empty.

Functions

func AutoResizeImage

func AutoResizeImage(h uint, img image.Image) image.Image

func DownloadImageFromUrl

func DownloadImageFromUrl(name, folder, url string) (image.Image, error)

func FindBoxArtUrl

func FindBoxArtUrl(title string, isBoxArt bool, serperAPIKey string) (string, error)

func LoadFonts

func LoadFonts()

func LoadIconForName

func LoadIconForName(name string, isBoxArt bool, serperAPIKey string) (image.Image, error)

func ResizeAndCropImage

func ResizeAndCropImage(w, h uint, img image.Image) image.Image

func ResizeImage

func ResizeImage(w, h uint, img image.Image) image.Image

Types

type BarChartItem

type BarChartItem interface {
	GetTitle() string
	GetMetric() int
	RenderMetric() string
	RenderIcon(height uint, serperAPIKey string) image.Image
}

type MostPlayedByNumGames

type MostPlayedByNumGames struct {
	Title    string  `db:"title" json:"title"`
	Playtime float64 `db:"playtime" json:"playtime"`
	Count    int     `db:"count" json:"count"`
}

func (MostPlayedByNumGames) GetMetric

func (mp MostPlayedByNumGames) GetMetric() int

func (MostPlayedByNumGames) GetTitle

func (mp MostPlayedByNumGames) GetTitle() string

func (MostPlayedByNumGames) RenderIcon

func (mp MostPlayedByNumGames) RenderIcon(height uint, serperAPIKey string) image.Image

func (MostPlayedByNumGames) RenderMetric

func (mp MostPlayedByNumGames) RenderMetric() string

type MostPlayedByPlaytime

type MostPlayedByPlaytime struct {
	Title    string  `db:"title" json:"title"`
	Playtime float64 `db:"playtime" json:"playtime"`
	Count    int     `db:"count" json:"count"`
	NoIcon   bool    `json:"-"`
}

func (MostPlayedByPlaytime) GetMetric

func (mp MostPlayedByPlaytime) GetMetric() int

func (MostPlayedByPlaytime) GetTitle

func (mp MostPlayedByPlaytime) GetTitle() string

func (MostPlayedByPlaytime) RenderIcon

func (mp MostPlayedByPlaytime) RenderIcon(height uint, serperAPIKey string) image.Image

func (MostPlayedByPlaytime) RenderMetric

func (mp MostPlayedByPlaytime) RenderMetric() string

type MostPlayedGame

type MostPlayedGame struct {
	Title    string  `db:"title" json:"title"`
	Platform string  `db:"platform" json:"platform"`
	Console  string  `db:"console" json:"console"`
	Playtime float64 `db:"playtime" json:"playtime"`
}

func (MostPlayedGame) GetMetric

func (mpg MostPlayedGame) GetMetric() int

func (MostPlayedGame) GetTitle

func (mpg MostPlayedGame) GetTitle() string

func (MostPlayedGame) RenderIcon

func (mpg MostPlayedGame) RenderIcon(height uint, serperAPIKey string) image.Image

func (MostPlayedGame) RenderMetric

func (mpg MostPlayedGame) RenderMetric() string

type Orientation

type Orientation int
const (
	Horizontal Orientation = 0
	Vertical   Orientation = iota
)

func (Orientation) String

func (o Orientation) String() string

type SaveableDrawing

type SaveableDrawing interface {
	SavePNG(path string) error
	EncodePNG(w io.Writer) error
}

func RenderMostPlayedWrapped

func RenderMostPlayedWrapped(title string, data []BarChartItem, n int, orientation Orientation, serperAPIKey string) SaveableDrawing

Jump to

Keyboard shortcuts

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