charge

package
v0.0.0-...-a30bc99 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllTags

func AllTags() ([]string, error)

AllTags returns all unique charge tags

func RenderChargeFromFile

func RenderChargeFromFile(name string, t tincture.Tincture) image.Image

RenderChargeFromFile renders a charge from a file using the given tincture and returns it as an Image

Types

type Charge

type Charge interface {
	Blazon(count int, tincture string) (string, error)
	GetTags() []string
	Render(bodyTincture tincture.Tincture) image.Image
}

Charge is an interface for charges

func All

func All() ([]Charge, error)

All returns all charges

func MatchingTag

func MatchingTag(tag string) ([]Charge, error)

MatchingTag returns all charges that match a tag

func Random

func Random() (Charge, error)

Random returns a random charge

func RandomMatchingTag

func RandomMatchingTag(tag string) (Charge, error)

RandomMatchingTag returns a random charge that matches a tag

type Cross

type Cross struct{}

Cross is a cross ordinary

func (Cross) Blazon

func (c Cross) Blazon(count int, tincture string) (string, error)

Blazon renders the blazon for a cross

func (Cross) GetTags

func (c Cross) GetTags() []string

GetTags returns all tags for the given cross

func (Cross) Render

func (c Cross) Render(bodyTincture tincture.Tincture) image.Image

type Data

type Data struct {
	Charges []Raster `json:"charges"`
}

Data is a struct containing a slice of Charges

type Fess

type Fess struct{}

Fess is a fess ordinary

func (Fess) Blazon

func (f Fess) Blazon(count int, tincture string) (string, error)

Blazon renders the blazon for a fess

func (Fess) GetTags

func (f Fess) GetTags() []string

GetTags returns all tags for the given fess

func (Fess) Render

func (f Fess) Render(bodyTincture tincture.Tincture) image.Image

type Group

type Group struct {
	Blazon  string
	Charges []Charge
	tincture.Tincture
	Position string
}

Group is a group of charges with a common tincture

func RandomGroup

func RandomGroup(fieldTincture tincture.Tincture) (Group, error)

RandomGroup returns a random group of charges

func RandomGroupByParameters

func RandomGroupByParameters(fieldTincture tincture.Tincture, tag string, numberOfCharges int) (Group, error)

RandomGroupByParameters returns a charge group matching the given parameters. Blank or zero values will return random results for the given parameter.

func (Group) RenderBlazon

func (group Group) RenderBlazon() (string, error)

RenderBlazon returns a string description of the blazon of a charge group

func (Group) RenderPNG

func (group Group) RenderPNG(width int, height int) image.Image

RenderPNG renders a charge group

type Pale

type Pale struct{}

Pale is a pale ordinary

func (Pale) Blazon

func (p Pale) Blazon(count int, tincture string) (string, error)

Blazon renders the blazon for a pale

func (Pale) GetTags

func (p Pale) GetTags() []string

GetTags returns all tags for the given pale

func (Pale) Render

func (p Pale) Render(bodyTincture tincture.Tincture) image.Image

type Raster

type Raster struct {
	Identifier string   `json:"identifier"`
	Name       string   `json:"name"`
	Noun       string   `json:"noun"`
	NounPlural string   `json:"noun_plural"`
	Descriptor string   `json:"descriptor"`
	SingleOnly bool     `json:"single_only"`
	Tags       []string `json:"tags"`
}

Raster is a charge that is rendered from a raster file

func AllRaster

func AllRaster() ([]Raster, error)

AllRaster returns all raster charges

func Load

func Load() ([]Raster, error)

Load returns all predefined raster charges from a JSON file on disk

func (Raster) Blazon

func (r Raster) Blazon(count int, tincture string) (string, error)

Blazon returns the blazon for a raster charge

func (Raster) GetTags

func (r Raster) GetTags() []string

func (Raster) Render

func (rc Raster) Render(bodyTincture tincture.Tincture) image.Image

Render renders a raster charge from a file

type Roundel

type Roundel struct{}

Roundel is a roundel ordinary

func (Roundel) Blazon

func (r Roundel) Blazon(count int, tincture string) (string, error)

Blazon renders the blazon for a roundel

func (Roundel) GetTags

func (r Roundel) GetTags() []string

GetTags returns all tags for the given roundel

func (Roundel) Render

func (r Roundel) Render(bodyTincture tincture.Tincture) image.Image

Jump to

Keyboard shortcuts

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