Documentation ¶
Index ¶
- func GenerateRandCode(size int, charType CharType) []byte
- type Bilinear
- type BilinearSrc
- type Captcha
- func (c *Captcha) AddFont(path string) error
- func (c *Captcha) AddFontFromBytes(contents []byte) error
- func (c *Captcha) Create(num int, t CharType) (*Image, string)
- func (c *Captcha) CreateCustom(str string) *Image
- func (c *Captcha) SetBkgColor(colors ...color.Color)
- func (c *Captcha) SetDisturbance(d DisturLevel)
- func (c *Captcha) SetFont(paths ...string) error
- func (c *Captcha) SetFrontColor(colors ...color.Color)
- func (c *Captcha) SetSize(w, h int)
- type CharType
- type DisturLevel
- type Image
- func (img *Image) DrawCircle(xc, yc, r int, fill bool, c color.Color)
- func (img *Image) DrawLine(x1, y1, x2, y2 int, c color.Color)
- func (img *Image) DrawString(font *truetype.Font, c color.Color, str string, fontsize float64)
- func (img *Image) FillBkg(c image.Image)
- func (img *Image) Rotate(angle float64) image.Image
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandCode ¶ added in v0.0.3
GenerateRandCode 生成随机验证码 size: 生成的验证码长度 charType: 生成的验证码的字符类型
Types ¶
type BilinearSrc ¶
type BilinearSrc struct {
// contains filtered or unexported fields
}
type Captcha ¶
type Captcha struct {
// contains filtered or unexported fields
}
func (*Captcha) AddFontFromBytes ¶
AddFontFromBytes allows to load font from slice of bytes, for example, load the font packed by https://github.com/jteeuwen/go-bindata
func (*Captcha) CreateCustom ¶
func (*Captcha) SetBkgColor ¶
func (*Captcha) SetDisturbance ¶
func (c *Captcha) SetDisturbance(d DisturLevel)
func (*Captcha) SetFrontColor ¶
type DisturLevel ¶
type DisturLevel int
const ( NORMAL DisturLevel = 4 MEDIUM DisturLevel = 8 HIGH DisturLevel = 16 )
type Image ¶
Image 图片
func (*Image) DrawCircle ¶
DrawCircle 画圆 xc,yc 圆心坐标 r 半径 fill是否填充颜色
func (*Image) DrawLine ¶
DrawLine 画直线 Bresenham算法(https://zh.wikipedia.org/zh-cn/布雷森漢姆直線演算法) x1,y1 起点 x2,y2终点
func (*Image) DrawString ¶
DrawString 写字
Click to show internal directories.
Click to hide internal directories.