Documentation
¶
Index ¶
- func ExistFile(path string) bool
- type DataParser
- func (dp *DataParser) GetOneData(indexData []string) map[string]any
- func (dp *DataParser) ParseData(info string) map[string]string
- func (dp *DataParser) ProcessBytes(data []byte) (map[int]map[string]any, error)
- func (dp *DataParser) ProcessData(filePath string) (map[int]map[string]any, error)
- func (dp *DataParser) ReadBytes(data []byte) ([]any, error)
- func (dp *DataParser) ReadFile(filePath string) ([]any, error)
- func (dp *DataParser) SplitString(s string, sep string) []string
- func (dp *DataParser) UnmarshalData(data []byte) ([]any, error)
- type ImgOption
- func (o *ImgOption) CreateBasePhoto(opt TemplateOption) *gg.Context
- func (o *ImgOption) CreateTplWithCtx(ctx *gg.Context, cnameData map[int]map[string]any) *gg.Context
- func (o *ImgOption) CreateTplWithLocal(imgTemplate string, cnameData map[int]map[string]any) *gg.Context
- func (o *ImgOption) InitFont()
- func (o *ImgOption) IsExistAndColor(colorData map[string]color.RGBA, lessonName string) color.RGBA
- type ImgOptionModifier
- type TemplateOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
ProcessBytes 处理字节流中的课程数据
func (*DataParser) ProcessData ¶
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 ¶
CreateTplWithCtx 从上下文创建模板
type ImgOptionModifier ¶
type ImgOptionModifier func(*ImgOption)
func WithFontOrPath ¶
func WithFontOrPath(fontOrPath string) ImgOptionModifier
WithFontOrPath 根据参数类型设置字体名称或字体路径
func WithStoragePath ¶
func WithStoragePath(path string) ImgOptionModifier
WithStoragePath 返回一个设置存储路径的 ImgOptionModifier
Click to show internal directories.
Click to hide internal directories.