captcha

package
v1.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//验证码噪点强度
	CaptchaComplexLower captcha.CaptchaComplex = iota
	CaptchaComplexMedium
	CaptchaComplexHigh
)

Variables

This section is empty.

Functions

func ColorToRGB

func ColorToRGB(colorVal int) color.RGBA

颜色代码转换为RGB input int output int red, green, blue.

func NewApplication

func NewApplication() captcha.Captcha

func RandFontFamily

func RandFontFamily() (*truetype.Font, error)

获取所及字体.

func RandLightColor

func RandLightColor() color.RGBA

随机生成浅色.

func RandText

func RandText(num int) string

生成随机字体.

func Random

func Random(min int64, max int64) float64

生成指定大小的随机数.

func ReadFonts

func ReadFonts(dirPth string, suffix string) (err error)

获取指定目录下的所有文件,不进入下一级目录搜索,可以匹配后缀过滤。

func SetFontFamily

func SetFontFamily(fontPath ...string)

添加一个字体路径到字体库.

Types

type Application

type Application struct {
}

type CaptchaImage

type CaptchaImage struct {
	Complex int
	Error   error
	// contains filtered or unexported fields
}

func NewCaptcha

func NewCaptcha() *CaptchaImage

func (*CaptchaImage) ClearImage

func (captcha *CaptchaImage) ClearImage()

清除一个图片对象内容

func (*CaptchaImage) DrawBeeline

func (captcha *CaptchaImage) DrawBeeline(point1 captcha.Point, point2 captcha.Point, lineColor color.RGBA)

画直线.

func (*CaptchaImage) DrawBorder

func (captcha *CaptchaImage) DrawBorder(borderColor color.RGBA)

画边框.

func (*CaptchaImage) DrawHollowLine

func (captcha *CaptchaImage) DrawHollowLine()

添加一个较粗的空白直线

func (*CaptchaImage) DrawLine

func (_captcha *CaptchaImage) DrawLine(num int)

画一条直线.

func (*CaptchaImage) DrawNoise

func (captcha *CaptchaImage) DrawNoise(complex captcha.CaptchaComplex)

画噪点.

func (*CaptchaImage) DrawSineLine

func (captcha *CaptchaImage) DrawSineLine()

画一条曲线.

func (*CaptchaImage) DrawText

func (captcha *CaptchaImage) DrawText(text string)

写字.

func (*CaptchaImage) DrawTextNoise

func (captcha *CaptchaImage) DrawTextNoise(complex captcha.CaptchaComplex)

画文字噪点.

func (*CaptchaImage) NewCaptchaImage

func (captcha *CaptchaImage) NewCaptchaImage() (img string, err error)

func (*CaptchaImage) SaveImage

func (captcha *CaptchaImage) SaveImage() (img string)

保存图片对象

type ImageFormat

type ImageFormat int
const (
	//图片格式
	ImageFormatPng ImageFormat = iota
	ImageFormatJpeg
	ImageFormatGif
)

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (captcha *ServiceProvider) Boot()

func (*ServiceProvider) Register

func (captcha *ServiceProvider) Register()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL