image

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes2Image

func Bytes2Image(d []byte) (img image.Image, e error)

[]byte -> Image

func Bytes2RGBA

func Bytes2RGBA(d []byte) (*image.RGBA, error)

[]byte -> RGBA

func Image2Bytes

func Image2Bytes(img image.Image) (d []byte, e error)

Image -> []byte

func Image2RGBA

func Image2RGBA(img image.Image) *image.RGBA

Image -> RGBA

func RGBA2Bytes

func RGBA2Bytes(rgba *image.RGBA) ([]byte, error)

RGBA -> []byte

func RGBA2Image

func RGBA2Image(rgba *image.RGBA) image.Image

RGBA -> Image

Types

type Drawer

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

func NewDrawer

func NewDrawer(data []byte) (d *Drawer, e error)

func (Drawer) DrawString

func (d Drawer) DrawString(text Text) (fixed.Point26_6, error)

绘字

func (Drawer) Output

func (d Drawer) Output() ([]byte, error)

func (*Drawer) SetDPI

func (d *Drawer) SetDPI(dpi float64)

func (*Drawer) SetFont

func (d *Drawer) SetFont(ttfPath string) error

设置字体样式

func (*Drawer) SetFontColor

func (d *Drawer) SetFontColor(color color.Color)

设置字体颜色

func (*Drawer) SetFontSize

func (d *Drawer) SetFontSize(size float64)

设置字体大小

type Text

type Text struct {
	Text string
	X    int // 文本区域左上角X坐标
	Y    int // 文本区域左上角Y坐标
}

图片绘字信息

Jump to

Keyboard shortcuts

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