Documentation ¶
Index ¶
- func ColorToRGB(colorVal int) 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 CaptchaComplex
- type CaptchaImage
- func (captcha *CaptchaImage) DrawBorder(borderColor color.RGBA) *CaptchaImage
- func (captcha *CaptchaImage) DrawHollowLine() *CaptchaImage
- func (captcha *CaptchaImage) DrawLine(num int) *CaptchaImage
- func (captcha *CaptchaImage) DrawNoise(complex CaptchaComplex) *CaptchaImage
- func (captcha *CaptchaImage) DrawSineLine() *CaptchaImage
- func (captcha *CaptchaImage) DrawText(text string) *CaptchaImage
- func (captcha *CaptchaImage) DrawTextNoise(complex CaptchaComplex) *CaptchaImage
- func (captcha *CaptchaImage) Img() (io io.Reader)
- func (captcha *CaptchaImage) SaveImage(w io.Writer, imageFormat ImageFormat) error
- type ImageFormat
- type Point
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ColorToRGB ¶
颜色代码转换为RGB input int output int red, green, blue.
Types ¶
type CaptchaComplex ¶
type CaptchaComplex int
const ( //验证码噪点强度 CaptchaComplexLower CaptchaComplex = iota CaptchaComplexMedium CaptchaComplexHigh )
type CaptchaImage ¶
func NewCaptchaImage ¶
func NewCaptchaImage(width int, height int, bgColor color.RGBA) *CaptchaImage
新建一个图片对象
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 CaptchaComplex) *CaptchaImage
画噪点.
func (*CaptchaImage) DrawSineLine ¶
func (captcha *CaptchaImage) DrawSineLine() *CaptchaImage
画一条曲线.
func (*CaptchaImage) DrawText ¶
func (captcha *CaptchaImage) DrawText(text string) *CaptchaImage
写字.
func (*CaptchaImage) DrawTextNoise ¶
func (captcha *CaptchaImage) DrawTextNoise(complex CaptchaComplex) *CaptchaImage
画文字噪点.
func (*CaptchaImage) SaveImage ¶
func (captcha *CaptchaImage) SaveImage(w io.Writer, imageFormat ImageFormat) error
保存图片对象
type ImageFormat ¶
type ImageFormat int
const ( //图片格式 ImageFormatPng ImageFormat = iota ImageFormatJpeg ImageFormatGif )
Click to show internal directories.
Click to hide internal directories.