poster

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetImage

func GetImage(src string) (m image.Image, err error)

GetImage 从源读取图片,支持网络和本地

func GetQRImage

func GetQRImage(url string, level qrcode.RecoveryLevel, size int) (image.Image, error)

GetQRImage 获取二维码图像

func LoadTextType

func LoadTextType(path string) (*truetype.Font, error)

LoadTextType 读取字体类型

func Merge

func Merge(png draw.Image, merged *os.File) error

Merge 合并到图片

func MergeImage

func MergeImage(PNG draw.Image, image image.Image, imageBound image.Point)

MergeImage 合并图片到载体

func NewMerged

func NewMerged(path string) (*os.File, error)

NewMerged 新建文件载体

func NewPNG

func NewPNG(X0 int, Y0 int, X1 int, Y1 int) *image.RGBA

NewPNG 新建图片载体

Types

type DImage

type DImage struct {
	PNG draw.Image //合并到的PNG切片,可用image.NewrRGBA设置
	X   int        //横坐标
	Y   int        //纵坐标
}

DImage 图片切片

type DText

type DText struct {
	PNG   draw.Image //合并到的PNG切片,可用image.NewrRGBA设置
	Title string     //文字
	X     int        //横坐标
	Y     int        //纵坐标
	Size  float64
	R     uint8
	G     uint8
	B     uint8
	A     uint8
}

DText 文字切片

func NewDrawText

func NewDrawText(png draw.Image) *DText

NewDrawText 创建新字体切片

func (*DText) MergeText

func (dtext *DText) MergeText(title string, tf *truetype.Font, x int, y int, rect image.Rectangle) error

MergeText 合并字体到载体

func (*DText) SetColor

func (dtext *DText) SetColor(R uint8, G uint8, B uint8)

SetColor 设置字体颜色

type Pt

type Pt struct {
	X int
	Y int
}

Pt 坐标

type Rect

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

新PNG载体

Jump to

Keyboard shortcuts

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