generator

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package generator handles the generation of achievement images.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownBackground = fmt.Errorf("unknown background")
)

list of errors returned by the generator

Functions

This section is empty.

Types

type Generator

type Generator struct {
	Backgrounds map[string]image.Image
	FontFace    font.Face
	// contains filtered or unexported fields
}

A Generator manages all resources required to generate achievement images and provides a method to generate them.

func New

func New() (*Generator, error)

New returns a new generator. It loads all embedded assets for quick access when needed.

func (*Generator) Generate

func (generator *Generator) Generate(background string, textTop string, textBottom string) ([]byte, error)

Generate generates an achievement image with the given background and text. It will return an error if the background is unknown.

Jump to

Keyboard shortcuts

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