Documentation ¶
Overview ¶
Package rendercard 渲染卡片
Index ¶
- Constants
- Variables
- 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, fontfile string, x, y, point, sigma float64, ox, oy int, ...) (err error)
- func DrawShadowedStringAnchored(canvas *gg.Context, s, fontfile string, x, y, point, sigma float64, ox, oy int, ...) (err error)
- func Fillet(dst image.Image, r int) image.Image
- func RandJPColor() (r, g, b int)
- func Transparency(dst image.Image, magnification float64) image.Image
- func Truncate(fontfile string, texts []string, maxW, fontsize float64) (newtexts []string, err error)
- type Alignment
- type Card
- 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 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, fontfile string, 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, fontfile string, x, y, point, sigma float64, ox, oy int, stringcolor, shadowcolor color.Color, ax, ay float64) (err error)
DrawShadowedStringAnchored 在锚点上绘制带阴影的文字
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 // TitleFont 标题字体 TitleFont string // TextFont 正文字体 TextFont string // 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 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 标题字体路径 TitleFont string // TextFont 正文字体路径 TextFont string // 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.