draw

package
v0.0.0-...-e57dd20 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 背包大小:352 x 332
	InvWidth, InvHeight = 352, 332
	// 人物框大小:100 x 140
	PlayerWidth, PlayerHeight = 100, 140
	// 人物框起点 (52, 16)
	PlayerStartX, PlayerStartY = 52, 16
	BackgroundColor            = &color.RGBA{R: 184, G: 184, B: 184, A: 255}
)

Functions

func CoveyImage

func CoveyImage(image image.Image, startX float64, startY float64, height float64, ctx *gg.Context)

CoveyImage draw one image onto another with resize

func GetFontFace

func GetFontFace(fontSize float64, dpi float64) (font.Face, error)

func Inventory

func Inventory(name string, inv image.Image, skin image.Image) (image.Image, error)

func LoadFont

func LoadFont(path string) error

func NewImageWithBackground

func NewImageWithBackground(width float64, height float64, color color.Color, face font.Face) *gg.Context

NewImageWithBackground create image with background color

func PrintChar

func PrintChar(startX float64, startY float64, c *component.Component, ctx *gg.Context, options *FontOptions) (float64, float64)

PrintChar print chars to image with options

func WithFontFace

func WithFontFace(fontSize float64, dpi float64, invoke func(face font.Face)) error

Types

type Assets

type Assets struct {
	Name string
	Path string
	Size int64
}

type FontOptions

type FontOptions struct {
	// ShadowOffset 阴影偏移
	ShadowOffset float64
	// BoldOffset 加粗偏移
	BoldOffset float64
	OffsetY    float64
}

func DefaultFontOptions

func DefaultFontOptions(fontSize int, offsetY float64) *FontOptions

type Skin

type Skin struct {
	File *image.NRGBA
	Slim bool
}

func NewSkin

func NewSkin(filePath string, slim bool) (*Skin, error)

func (*Skin) GetFace

func (s *Skin) GetFace() *image.NRGBA

GetFace 1 scale for 8 px

Jump to

Keyboard shortcuts

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