initialser

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2016 License: MIT Imports: 17 Imported by: 0

README

initialser

initials avatar

Installation

$ go get github.com/leonlau/initialser
import ("github.com/leonlau/initialser")
d:=initialser.NewDrawer(initialser.NewAvatar("joey"))
d.Draw() //image.Image
// d.DrawToBytes()
// d.DrawToWriter()

how to use

server

demo

Documentation

Index

Constants

View Source
const Version = "0.0.1 beta"

Variables

This section is empty.

Functions

func AppendFontPath

func AppendFontPath(path string)

AppendFontPath append font search path

func OnlyPath added in v0.0.4

func OnlyPath(path string)

Types

type Avatar

type Avatar struct {
	Size       int
	FontSize   int
	Font       string
	Background string
	Color      string

	Ext string
	// contains filtered or unexported fields
}

Avatar avatar

func NewAvatar

func NewAvatar(text string) *Avatar

NewAvatar Avatar

func (*Avatar) Key

func (a *Avatar) Key() string

Key cache key,md5

func (*Avatar) Svg

func (a *Avatar) Svg() string

Svg format svg

func (*Avatar) Text

func (a *Avatar) Text(text string) *Avatar

func (*Avatar) Valid

func (a *Avatar) Valid() bool

Valid check params

type Color

type Color struct {
	R, G, B float64
}

A color is stored internally using sRGB (standard RGB) values in the range 0-1

func (Color) RGBA

func (col Color) RGBA() (r, g, b, a uint32)

Implement the Go color.Color interface.

type Drawer

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

func NewDrawer

func NewDrawer(avatar *Avatar) (*Drawer, error)

NewDrawer create a Drawer

func (*Drawer) Draw

func (d *Drawer) Draw() (image.Image, error)

Draw draw

func (*Drawer) DrawToBytes

func (d *Drawer) DrawToBytes(encoding ...string) ([]byte, error)

DrawToBytes draw image data to []byte

func (*Drawer) DrawToWriter

func (d *Drawer) DrawToWriter(w io.Writer, encoding ...string) error

DrawToWriter draw image data to writer

type LRUCache

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

LRUCache LRUCache struct

func NewLRUCache

func NewLRUCache(maxSize int) *LRUCache

NewLRUCache create a cache

func (*LRUCache) Delete

func (cache *LRUCache) Delete(key string) (val interface{}, existed bool)

Delete Delete key

func (*LRUCache) Get

func (cache *LRUCache) Get(key string) (val interface{}, ok bool)

Get get value

func (*LRUCache) Len

func (cache *LRUCache) Len() int

Len length

func (*LRUCache) MaxSize

func (cache *LRUCache) MaxSize() int

MaxSize MaxSize

func (*LRUCache) Set

func (cache *LRUCache) Set(key string, val interface{})

Set set key val

Jump to

Keyboard shortcuts

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