Documentation ¶
Index ¶
- Constants
- Variables
- func ColorToRGB(colorVal int) color.RGBA
- func RandColor() color.RGBA
- func RandDeepColor() color.RGBA
- func RandFontFamily() (*truetype.Font, error)
- func RandLightColor() color.RGBA
- func RandText(num int) string
- func Random(min int64, max int64) float64
- func ReadFonts(dirPth string, suffix string) (err error)
- func SetFontFamily(fontPath ...string)
- type CaptchaImage
- func (captcha *CaptchaImage) DrawBorder(borderColor color.RGBA) *CaptchaImage
- func (captcha *CaptchaImage) DrawHollowLine() *CaptchaImage
- func (captcha *CaptchaImage) DrawNoise(complex int) *CaptchaImage
- func (captcha *CaptchaImage) DrawSineLine() *CaptchaImage
- func (captcha *CaptchaImage) DrawText(text string) error
- func (captcha *CaptchaImage) DrawTextNoise(complex int) error
- func (captcha *CaptchaImage) Drawline(num int) *CaptchaImage
- func (this *CaptchaImage) SaveImage(w io.Writer, imageFormat int) error
- type Point
Constants ¶
View Source
const ( //图片格式 ImageFormatPng = iota ImageFormatJpeg ImageFormatGif //验证码噪点强度 CaptchaComplexLower = iota CaptchaComplexMedium CaptchaComplexHigh )
Variables ¶
View Source
var (
FontFamily []string = make([]string, 0)
)
Functions ¶
func ColorToRGB ¶
颜色代码转换为RGB input int output int red, green, blue.
Types ¶
type CaptchaImage ¶
type CaptchaImage struct { Complex int // contains filtered or unexported fields }
func NewCaptchaImage ¶
新建一个图片对象
func (*CaptchaImage) DrawBorder ¶
func (captcha *CaptchaImage) DrawBorder(borderColor color.RGBA) *CaptchaImage
画边框.
func (*CaptchaImage) DrawHollowLine ¶
func (captcha *CaptchaImage) DrawHollowLine() *CaptchaImage
添加一个较粗的空白直线
func (*CaptchaImage) DrawNoise ¶
func (captcha *CaptchaImage) DrawNoise(complex int) *CaptchaImage
画噪点.
func (*CaptchaImage) DrawSineLine ¶
func (captcha *CaptchaImage) DrawSineLine() *CaptchaImage
func (*CaptchaImage) DrawTextNoise ¶
func (captcha *CaptchaImage) DrawTextNoise(complex int) error
画文字噪点.
Click to show internal directories.
Click to hide internal directories.