Documentation ¶
Index ¶
- Variables
- func PointInRect(p Point, rect DrawRect) bool
- func ValidBehaviorCaptcha(cr CaptchaResult, userPoints []Point) bool
- func ValidBehaviorRects(rects []DrawRect, userPoints []Point) bool
- type AreaPoint
- type Canvas
- func (c *Canvas) DrawBackgroud()
- func (c *Canvas) DrawBezierLines(lineCount int)
- func (c *Canvas) DrawCircle(xc, yc, r int, fill bool, cc color.Color)
- func (c *Canvas) DrawCircles(circleCount int)
- func (c *Canvas) DrawFont(fontText string, fontColors []color.Color) (*Palette, *AreaPoint)
- func (c *Canvas) DrawLine(p1, p2 Point, color color.Color)
- func (c *Canvas) DrawLines(lineCount int)
- func (c *Canvas) DrawString(text string) []DrawRect
- type Captcha
- func (cp *Captcha) GenBehaviorCNCaptcha() (CaptchaResult, error)
- func (cp *Captcha) GenCaptchaImage(text string) (CaptchaResult, error)
- func (cp *Captcha) GenRandomNormalCaptcha(length int) (CaptchaResult, error)
- func (cp *Captcha) SetBackgroundColor(color color.Color)
- func (cp *Captcha) SetFont(font *truetype.Font)
- func (cp *Captcha) SetFontColors(colors ...color.Color)
- func (cp *Captcha) SetFontSize(fontSize int)
- func (cp *Captcha) SetSytle(style CaptchaStyle)
- type CaptchaResult
- type CaptchaStyle
- type Config
- type DrawRect
- type Palette
- type Point
Constants ¶
This section is empty.
Variables ¶
View Source
var Alphabets = "abcdefghijklmnopqrstuvwxyxABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
View Source
var CNChars = []string{
"热情",
"帮助",
"聪明",
"活泼",
"笑容",
"风景",
"眼睛",
"太阳",
"棉花",
"落叶",
"翅膀",
"松果",
"表情",
"船只",
"灯笼",
"天气",
"时光",
"鲜花",
"火车",
"街道",
"问题",
"奇怪",
"欢乐",
"端正",
"大方",
"清楚",
"欢喜",
"完整",
"高兴",
"漂亮",
"干净",
"仔细",
"完全",
"前后",
"马虎",
"冷清",
"普通",
"高贵",
"优雅",
"热闹",
"云彩",
"同学",
"黑板",
"篮球",
"足球",
"城市",
"组合",
"玩具",
"表格",
"希望",
"和平",
"同意",
"目标",
"工作",
"学习",
"顺利",
"谈话",
"风格",
"如果",
"天气",
"严格",
"教育",
"讨论",
"明亮",
"相信",
"犹豫",
"坚定",
"缓慢",
"勇敢",
"提前",
"杰出",
"安全",
"宽容",
}
Functions ¶
func ValidBehaviorCaptcha ¶
func ValidBehaviorCaptcha(cr CaptchaResult, userPoints []Point) bool
ValidBehaviorCaptcha 验证行为点击验证码是否正确
func ValidBehaviorRects ¶
ValidBehaviorRects 验证行为点是否在验证码矩形中
Types ¶
type Canvas ¶
func (*Canvas) DrawBezierLines ¶
DrawBezierLines 画贝塞尔干扰线
func (*Canvas) DrawCircle ¶
DrawCircle 画圆
func (*Canvas) DrawCircles ¶
DrawCircles 随机产生circleCount干扰点
type Captcha ¶
func NewCaptcha ¶
func (*Captcha) GenBehaviorCNCaptcha ¶
func (cp *Captcha) GenBehaviorCNCaptcha() (CaptchaResult, error)
GenBehaviorCaptcha 生成中文点击验证码 - 点击行为验证码
func (*Captcha) GenCaptchaImage ¶
func (cp *Captcha) GenCaptchaImage(text string) (CaptchaResult, error)
GenCaptchaImage 生成文字的验证码图片
func (*Captcha) GenRandomNormalCaptcha ¶
func (cp *Captcha) GenRandomNormalCaptcha(length int) (CaptchaResult, error)
GenNormalRandomCaptcha 随机验证码 - 普通验证码
func (*Captcha) SetBackgroundColor ¶
SetBackgroundColor 设置背景颜色
func (*Captcha) SetFontColors ¶
SetFontColors 设置字体颜色
type CaptchaResult ¶
type CaptchaStyle ¶
type CaptchaStyle int32
const ( CaptchaStyle_Normal CaptchaStyle = 0 CaptchaStyle_Behavior CaptchaStyle = 1 )
Click to show internal directories.
Click to hide internal directories.