Documentation ¶
Index ¶
- type AvatarBuilder
- func (ab *AvatarBuilder) GenerateImage(s string) ([]byte, error)
- func (ab *AvatarBuilder) GenerateImageAndSave(s string, outName string) error
- func (ab *AvatarBuilder) GetFontWidth() int
- func (ab *AvatarBuilder) SetAvatarSize(w int, h int)
- func (ab *AvatarBuilder) SetBackGroundColor(c color.Color)
- func (ab *AvatarBuilder) SetBackGroundColorHex(hex uint32)
- func (ab *AvatarBuilder) SetFontSize(size float64)
- func (ab *AvatarBuilder) SetFrontGroundColor(c color.Color)
- func (ab *AvatarBuilder) SetFrontGroundColorHex(hex uint32)
- type BuilderOption
- func SetAvatarSize(w int, h int) BuilderOption
- func SetBackGroundColor(c color.Color) BuilderOption
- func SetBackGroundColorHex(hex uint32) BuilderOption
- func SetFontSize(size float64) BuilderOption
- func SetFrontGroundColor(c color.Color) BuilderOption
- func SetFrontGroundColorHex(hex uint32) BuilderOption
- type FontCenterCalculator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AvatarBuilder ¶
func NewAvatarBuilder ¶
func NewAvatarBuilder(fontFile string, calc FontCenterCalculator) *AvatarBuilder
func NewAvatarBuilderWithOption ¶
func NewAvatarBuilderWithOption(fontFile string, calc FontCenterCalculator, opt ...BuilderOption) *AvatarBuilder
func (*AvatarBuilder) GenerateImage ¶
func (ab *AvatarBuilder) GenerateImage(s string) ([]byte, error)
func (*AvatarBuilder) GenerateImageAndSave ¶
func (ab *AvatarBuilder) GenerateImageAndSave(s string, outName string) error
func (*AvatarBuilder) GetFontWidth ¶
func (ab *AvatarBuilder) GetFontWidth() int
func (*AvatarBuilder) SetAvatarSize ¶
func (ab *AvatarBuilder) SetAvatarSize(w int, h int)
func (*AvatarBuilder) SetBackGroundColor ¶
func (ab *AvatarBuilder) SetBackGroundColor(c color.Color)
func (*AvatarBuilder) SetBackGroundColorHex ¶
func (ab *AvatarBuilder) SetBackGroundColorHex(hex uint32)
func (*AvatarBuilder) SetFontSize ¶
func (ab *AvatarBuilder) SetFontSize(size float64)
func (*AvatarBuilder) SetFrontGroundColor ¶
func (ab *AvatarBuilder) SetFrontGroundColor(c color.Color)
func (*AvatarBuilder) SetFrontGroundColorHex ¶
func (ab *AvatarBuilder) SetFrontGroundColorHex(hex uint32)
type BuilderOption ¶
type BuilderOption func(*AvatarBuilder)
func SetAvatarSize ¶
func SetAvatarSize(w int, h int) BuilderOption
func SetBackGroundColor ¶
func SetBackGroundColor(c color.Color) BuilderOption
func SetBackGroundColorHex ¶
func SetBackGroundColorHex(hex uint32) BuilderOption
func SetFontSize ¶
func SetFontSize(size float64) BuilderOption
func SetFrontGroundColor ¶
func SetFrontGroundColor(c color.Color) BuilderOption
func SetFrontGroundColorHex ¶
func SetFrontGroundColorHex(hex uint32) BuilderOption
type FontCenterCalculator ¶
type FontCenterCalculator interface { // CalculateCenterLocation used to calculate center location in different font style CalculateCenterLocation(string, *AvatarBuilder) (int, int) }
Click to show internal directories.
Click to hide internal directories.