comicgen

package module
v0.0.0-...-df5a96c Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2017 License: MIT Imports: 27 Imported by: 1

README

comicgen

A stupid comic generator.

GoDoc Go Walker Go report Build Status

Documentation

Index

Constants

View Source
const (
	EmotionAngry    Emotion = "angry"
	EmotionBored            = "bored"
	EmotionHappy            = "happy"
	EmotionHi               = "hi"
	EmotionIdle             = "idle"
	EmotionLove             = "love"
	EmotionMe               = "me"
	EmotionQuestion         = "question"
	EmotionSad              = "sad"
	EmotionScared           = "scared"
	EmotionSmug             = "smug"
	EmotionWalk             = "walk"
	EmotionYell             = "yell"
	EmotionYou              = "you"
)

All the possible emotion states.

Variables

View Source
var CharacterNames = []string{}

Functions

This section is empty.

Types

type Character

type Character struct {
	FileName string
	Name     string
	Width    int
	Height   int
	Emotions map[Emotion][]int
}

A Character contains the information necessary to draw one character in a comic.

func (*Character) GetFrame

func (c *Character) GetFrame(message string) int

GetFrame will return a frame for a message. It will parse any emotion from the message and randomly select a matching frame for those emotions.

func (*Character) MaxFrame

func (c *Character) MaxFrame() int

MaxFrame returns the highest frame number available to the character.

type ComicGen

type ComicGen struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ComicGen is a comic generator!

func NewComicGen

func NewComicGen(font string, useGooglEmoji bool) *ComicGen

NewComicGen creates a new comic generator.

func (*ComicGen) MakeComic

func (comic *ComicGen) MakeComic(script *Script) (img image.Image, err error)

MakeComic makes a comic.

type ComicType

type ComicType int

A ComicType specifies the type of comic to create.

const (
	// ComicTypeSimple generates a comic with large text bubbles and avatars.
	ComicTypeSimple ComicType = iota
	// ComicTypeChat emulates Microsoft Comic Chat and creates a comic with characters and backgrounds.
	ComicTypeChat
)

type Emotion

type Emotion string

An Emotion is a possible state for a character in a comic.

type Message

type Message struct {
	Speaker int
	Text    string
	Author  string
}

Message contains a single message for a comment.

type MultiBounds

type MultiBounds struct {
	AllBounds  [][]float64
	LineHeight float64
}

MultiBounds is a struct containing bounds information for multiple lines of text.

func (*MultiBounds) AddBound

func (m *MultiBounds) AddBound(l, t, r, b float64)

AddBound will add a new bound.

func (*MultiBounds) AddStringBounds

func (m *MultiBounds) AddStringBounds(l, t, r, b float64)

AddStringBounds will add a new bound and automodify the bound to be positioned on the next line.

func (*MultiBounds) Bounds

func (m *MultiBounds) Bounds() (l, t, r, b float64)

Bounds returns the total bounds of all lines.

func (*MultiBounds) GetBound

func (m *MultiBounds) GetBound(i int) (float64, float64, float64, float64)

GetBound returns the bound at the desired line.

func (*MultiBounds) Length

func (m *MultiBounds) Length() int

Length returns the number of lines contained in the MultiBounds.

func (*MultiBounds) Offset

func (m *MultiBounds) Offset(offset *MultiBounds) *MultiBounds

Offset returns a new MultiBound offset by another.

type Script

type Script struct {
	Type     ComicType
	Messages []*Message
	Avatars  map[int]string
	Author   string
	Room     string
}

Script contains all the data necessary to generate a comic.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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