captcha

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NUM   = iota //number
	LCHAR        //Lowercase letters
	UCHAR        //Upper case letters
	ALL          //number+letters
)

常量

Variables

This section is empty.

Functions

This section is empty.

Types

type Captcha

type Captcha struct {
	// contains filtered or unexported fields
}

Captcha

func NewCaptcha

func NewCaptcha() *Captcha

NewCaptcha

func (*Captcha) AddBackColors

func (c *Captcha) AddBackColors(colors ...color.Color)

AddBackColors

func (*Captcha) AddColors

func (c *Captcha) AddColors(colors ...color.Color)

AddColors

func (*Captcha) AddFonts

func (c *Captcha) AddFonts(paths ...string)

AddFonts

func (*Captcha) Create

func (c *Captcha) Create(num int, option CaptchaType) (*Image, string)

Create

func (*Captcha) SetDisturbLevel

func (c *Captcha) SetDisturbLevel(disturb DisturbLevel)

SetDisturbLevel 设置干扰级别

func (*Captcha) SetSize

func (c *Captcha) SetSize(width, height int)

SetSize

type CaptchaType

type CaptchaType int

验证码类型

type DisturbLevel

type DisturbLevel int

干扰级别

const (
	NONE DisturbLevel = iota
	NORMAL
	MEDIUM
	HIGH
)

干扰级别

type Image

type Image struct {
	*image.RGBA
}

Image

func NewImage

func NewImage(width, height int) *Image

NewImage

func (*Image) Base64Encode

func (i *Image) Base64Encode() string

Base64Encode

func (*Image) DrawLine

func (i *Image) DrawLine(x1, y1, x2, y2 int, colr color.Color)

DrawLine

func (*Image) DrawString

func (i *Image) DrawString(font *truetype.Font, color color.Color, text string, fontSize float64)

DrawString

func (*Image) Fill

func (i *Image) Fill(img image.Image)

Fill

func (*Image) SaveImage

func (i *Image) SaveImage(fullPath string)

SaveImage

type Size

type Size struct {
	Width  int
	Height int
}

Size

Jump to

Keyboard shortcuts

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