service

package
Version: v0.0.0-...-ad33a55 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXT_JPG = ".jpg"
)

Variables

This section is empty.

Functions

func Generate

func Generate() (err error)

Types

type Avatar

type Avatar struct {
	Path      string
	ThumbPath string
	ThumbFile *os.File
	X         int
	Y         int
	Width     int
	Height    int
}

func (*Avatar) Thumb

func (a *Avatar) Thumb() (err error)

type Content

type Content struct {
	Title   string
	Author  string
	Company string
	BgPath  string
	DstPath string
	DstFile *os.File
}

type DrawText

type DrawText struct {
	JPG draw.Image

	Title string
	X0    int
	Y0    int
	Size0 float64

	Author string
	X1     int
	Y1     int
	Size1  float64

	Company string
	X2      int
	Y2      int
	Size2   float64
}

type Poster

type Poster struct {
	*Content
	Avatar *Avatar
	*Rect
	Qr *Qr
}

func NewPoster

func NewPoster(content Content, rect *Rect, avatar Avatar, qr Qr) *Poster

func (*Poster) DrawPoster

func (p *Poster) DrawPoster(d *DrawText, fontName string) error

func (*Poster) Generate

func (p *Poster) Generate() (err error)

type Qr

type Qr struct {
	Path string
	X    int
	Y    int
}

type QrCode

type QrCode struct {
	URL    string
	Width  int
	Height int
	Ext    string
	Level  qr.ErrorCorrectionLevel
	Mode   qr.Encoding
}

func NewQrCode

func NewQrCode(url string, width, height int, level qr.ErrorCorrectionLevel, mode qr.Encoding) *QrCode

func (*QrCode) Encode

func (q *QrCode) Encode(folderPath string) (filePath string, err error)

Encode generate QR code

func (*QrCode) GetQrCodeExt

func (q *QrCode) GetQrCodeExt() string

type Rect

type Rect struct {
	X0 int
	Y0 int
	X1 int
	Y1 int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL