Documentation
¶
Overview ¶
Package rendercard 渲染卡片
Index ¶
- Constants
- Variables
- func DrawRankingCard(fontdata []byte, title string, rankinfo []*RankInfo) (img image.Image, err error)
- func DrawRoundShadowedRectangle(canvas *gg.Context, x, y, w, h, r, sr, sigma float64, ox, oy int, ...)
- func DrawShadowedRectangle(canvas *gg.Context, x, y, w, h, r, sigma float64, ox, oy int, ...)
- func DrawShadowedString(canvas *gg.Context, s string, fontdata []byte, x, y, point, sigma float64, ...) (err error)
- func DrawShadowedStringAnchored(canvas *gg.Context, s string, fontdata []byte, x, y, point, sigma float64, ...) (err error)
- func Fillet(dst image.Image, r float64) image.Image
- func RandJPColor() (r, g, b int)
- func RenderServerListLogo(fontdata []byte) (img image.Image, err error)
- func RenderServerPic(pluginlist []*PluginInfo, torussd, glowsd []byte, zbplogopath string, ...) (img image.Image, err error)
- func Transparency(dst image.Image, magnification float64) image.Image
- func Truncate(fontdata []byte, texts []string, maxW, fontsize float64) (newtexts []string, err error)
- type Alignment
- type Card
- type PluginInfo
- type RankInfo
- type Title
Constants ¶
View Source
const (
// DefaultWidth 默认宽度
DefaultWidth = 1272.0
)
Variables ¶
View Source
var ( // ErrNilTextFont ... ErrNilTextFont = errors.New("nil TextFont") // ErrNilTitleFont ... ErrNilTitleFont = errors.New("nil TitleFont") )
Functions ¶
func DrawRankingCard ¶ added in v0.2.0
func DrawRankingCard(fontdata []byte, title string, rankinfo []*RankInfo) (img image.Image, err error)
DrawRankingCard ...
func DrawRoundShadowedRectangle ¶ added in v0.0.7
func DrawRoundShadowedRectangle(canvas *gg.Context, x, y, w, h, r, sr, sigma float64, ox, oy int, rectanglecolor, shadowcolor color.Color)
DrawRoundShadowedRectangle 绘制带阴影的圆角矩形
func DrawShadowedRectangle ¶ added in v0.0.7
func DrawShadowedRectangle(canvas *gg.Context, x, y, w, h, r, sigma float64, ox, oy int, shadowcolor color.Color)
DrawShadowedRectangle 绘制阴影
func DrawShadowedString ¶ added in v0.0.7
func DrawShadowedString(canvas *gg.Context, s string, fontdata []byte, x, y, point, sigma float64, ox, oy int, stringcolor, shadowcolor color.Color) (err error)
DrawShadowedString 绘制带阴影的文字
func DrawShadowedStringAnchored ¶ added in v0.0.7
func DrawShadowedStringAnchored(canvas *gg.Context, s string, fontdata []byte, x, y, point, sigma float64, ox, oy int, stringcolor, shadowcolor color.Color, ax, ay float64) (err error)
DrawShadowedStringAnchored 在锚点上绘制带阴影的文字
func RenderServerListLogo ¶ added in v0.1.0
RenderServerListLogo ...
func RenderServerPic ¶ added in v0.1.0
func RenderServerPic(pluginlist []*PluginInfo, torussd, glowsd []byte, zbplogopath string, serverlistlogo image.Image) (img image.Image, err error)
RenderServerPic ...
func Transparency ¶ added in v0.0.2
Transparency 更改透明度 magnification 倍率值
Types ¶
type Card ¶ added in v0.0.4
type Card struct { // Width 宽度,默认600 Width int // Height 高度,默认由Title+Text内容决定 Height int // BackgroundImage 背景图 BackgroundImage string // TitleFontData 标题字体数据 TitleFontData []byte // TextFontData 正文字体数据 TextFontData []byte // Title 标题内容 Title string // CanTitleShown 是否显示标题 CanTitleShown bool // IsTextSplitPerElement true为每个元素按行显示,false按空格分割显示; IsTextSplitPerElement bool // TitleAlign 标题布局[Left|Center|Right],默认Left TitleAlign Alignment // Text 正文内容 Text []string }
Card 卡片配置
func (*Card) DrawTextCard ¶ added in v0.0.4
DrawTextCard 绘制文字卡片
type PluginInfo ¶ added in v0.1.1
PluginInfo ...
type RankInfo ¶ added in v0.2.0
type RankInfo struct { Avatar image.Image TopLeftText string BottomLeftText string RightText string }
RankInfo ...
type Title ¶ added in v0.0.4
type Title struct { // Line 行数 Line int // IsEnabled 状态 IsEnabled bool // LeftTitle 左侧标题 LeftTitle string // LeftSubtitle 左侧副标题 LeftSubtitle string // RightTitle 右侧标题 RightTitle string // RightSubtitle 右侧副标题 RightSubtitle string // ImagePath 图片路径 ImagePath string // TitleFont 标题字体数据 TitleFontData []byte // TextFont 正文字体数据 TextFontData []byte // OffsetX 文字X坐标偏移 向右为正方向 OffsetX float64 // OffsetX 文字Y坐标偏移 向下为正方向 OffsetY float64 // TitleFontOffsetPoint 标题字体大小偏移 TitleFontOffsetPoint float64 // TextFontOffsetPoint 正文字体大小偏移 TextFontOffsetPoint float64 }
Title 标题配置
func (*Title) DrawTitleWithText ¶ added in v0.0.4
DrawTitleWithText 绘制标题正文
Click to show internal directories.
Click to hide internal directories.