timetable

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExistFile

func ExistFile(path string) bool

Types

type DataParser

type DataParser struct{}

DataParser 结构体用于处理数据解析

func NewDataParser

func NewDataParser() *DataParser

func (*DataParser) GetOneData

func (dp *DataParser) GetOneData(indexData []string) map[string]any

GetOneData 获取一周的数据

func (*DataParser) ParseData

func (dp *DataParser) ParseData(info string) map[string]string

ParseData 解析单个课程信息

func (*DataParser) ProcessBytes

func (dp *DataParser) ProcessBytes(data []byte) (map[int]map[string]any, error)

ProcessBytes 处理字节流中的课程数据

func (*DataParser) ProcessData

func (dp *DataParser) ProcessData(filePath string) (map[int]map[string]any, error)

ProcessData 处理文件中的课程数据

func (*DataParser) ReadBytes

func (dp *DataParser) ReadBytes(data []byte) ([]any, error)

ReadBytes 读取字节流内容

func (*DataParser) ReadFile

func (dp *DataParser) ReadFile(filePath string) ([]any, error)

ReadFile 读取文件内容

func (*DataParser) SplitString

func (dp *DataParser) SplitString(s string, sep string) []string

SplitString 分割字符串

func (*DataParser) UnmarshalData

func (dp *DataParser) UnmarshalData(data []byte) ([]any, error)

UnmarshalData 将字节数据解析为 []any

type ImgOption

type ImgOption struct {
	FontName        string // 字体名称
	FontPath        string // 字体路径
	StoragePath     string // 存储路径
	TemplateImgPath string // 模板图片路径
	Size            struct {
		Width  int
		Height int
	}
	Image *gg.Context // 图片对象
}

ImgOption 包含生成图片所需的各种选项

func NewGenerator

func NewGenerator(modifiers ...ImgOptionModifier) *ImgOption

NewGenerator 根据提供的修改函数创建一个新的 ImgOption 实例

func (*ImgOption) CreateBasePhoto

func (o *ImgOption) CreateBasePhoto(opt TemplateOption) *gg.Context

CreateBasePhoto 创建基础模板图片

func (*ImgOption) CreateTplWithCtx

func (o *ImgOption) CreateTplWithCtx(ctx *gg.Context, cnameData map[int]map[string]any) *gg.Context

CreateTplWithCtx 从上下文创建模板

func (*ImgOption) CreateTplWithLocal

func (o *ImgOption) CreateTplWithLocal(imgTemplate string, cnameData map[int]map[string]any) *gg.Context

CreateTplWithLocal 从本地文件创建模板

func (*ImgOption) InitFont

func (o *ImgOption) InitFont()

InitFont 方法用于初始化字体

func (*ImgOption) IsExistAndColor

func (o *ImgOption) IsExistAndColor(colorData map[string]color.RGBA, lessonName string) color.RGBA

IsExistAndColor 方法用于检查课程是否存在于颜色数据中

type ImgOptionModifier

type ImgOptionModifier func(*ImgOption)

func WithFontOrPath

func WithFontOrPath(fontOrPath string) ImgOptionModifier

WithFontOrPath 根据参数类型设置字体名称或字体路径

func WithSize

func WithSize(w, h int) ImgOptionModifier

WithSize 返回一个设置图片尺寸的 ImgOptionModifier

func WithStoragePath

func WithStoragePath(path string) ImgOptionModifier

WithStoragePath 返回一个设置存储路径的 ImgOptionModifier

type TemplateOption

type TemplateOption struct {
	WeekTime   map[int]string
	CreateTime string
	Cname      string
}

Jump to

Keyboard shortcuts

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