Documentation ¶
Index ¶
- Constants
- 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 StrType) (*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 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
- type StrType
Constants ¶
View Source
const ( NUM StrType = 0 // 数字 LOWER = 1 // 小写字母 UPPER = 2 // 大写字母 ALL = 3 // 全部 )
View Source
const ( NORMAL DisturLevel = 4 MEDIUM = 8 HIGH = 16 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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
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.