click

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const Version = "2.0.0"

Version # of captcha

Variables

This section is empty.

Functions

func CheckPoint

func CheckPoint(sx, sy, dx, dy, width, height, padding int64) bool

CheckPoint is the position of the detection point

Types

type Builder

type Builder interface {
	SetOptions(opts ...Option)
	SetResources(resources ...Resource)
	Clear()
	Make() Captcha
	MakeWithShape() Captcha
}

Builder .

func NewBuilder

func NewBuilder(opts ...Option) Builder

NewBuilder .

type CaptData

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

CaptData .

func (CaptData) GetData

func (c CaptData) GetData() map[int]*Dot

GetData is to get dot

func (CaptData) GetMasterImage

func (c CaptData) GetMasterImage() imagedata.JPEGImageData

GetMasterImage is to get master image

func (CaptData) GetThumbImage

func (c CaptData) GetThumbImage() imagedata.PNGImageData

GetThumbImage is to get thumbnail image

type Captcha

type Captcha interface {
	GetOptions() *Options
	Generate() (CaptchaData, error)
	// contains filtered or unexported methods
}

Captcha .

type CaptchaData

type CaptchaData interface {
	GetData() map[int]*Dot
	GetMasterImage() imagedata.JPEGImageData
	GetThumbImage() imagedata.PNGImageData
}

CaptchaData .

type Dot

type Dot struct {
	Index  int    `json:"index"`
	X      int    `json:"x"`
	Y      int    `json:"y"`
	Size   int    `json:"size"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
	Text   string `json:"text"`
	Shape  string `json:"shape"`
	Angle  int    `json:"angle"`
	Color  string `json:"color"`
	Color2 string `json:"color2"`
}

Dot .

type DrawDot

type DrawDot struct {
	Dot              *Dot
	X                int
	Y                int
	FontDPI          int
	Text             string
	Image            image.Image
	UseOriginalColor bool
	Size             int
	Width            int
	Height           int
	Angle            int
	Color            string
	Color2           string
	Font             *truetype.Font
	DrawType         DrawType
}

DrawDot .

type DrawImage

type DrawImage interface {
	DrawWithNRGBA(params *DrawImageParams) (image.Image, error)
	DrawWithPalette(params *DrawImageParams, textColors []color.Color, bgColors []color.Color) (image.Image, error)
	DrawWithNRGBA2(params *DrawImageParams, textColors []color.Color, bgColors []color.Color) (image.Image, error)
}

func NewDrawImage

func NewDrawImage() DrawImage

NewDrawImage .

type DrawImageParams

type DrawImageParams struct {
	Width                 int
	Height                int
	Background            image.Image
	BackgroundDistort     int
	BackgroundCirclesNum  int
	BackgroundSlimLineNum int
	Alpha                 float32
	FontHinting           font.Hinting
	CaptchaDrawDot        []*DrawDot
	ShowShadow            bool
	ShadowColor           string
	ShadowPoint           *option.Point
	ThumbDisturbAlpha     float32
}

DrawImageParams .

type DrawType

type DrawType int
const (
	DrawTypeString DrawType = iota
	DrawTypeImage
)

type Mode

type Mode int
const (
	ModeText Mode = iota
	ModeShape
)

type Option

type Option func(*Options)

func WithDisabledRangeVerifyLen added in v2.0.1

func WithDisabledRangeVerifyLen(disabled bool) Option

WithDisabledRangeVerifyLen .

func WithDisplayShadow

func WithDisplayShadow(val bool) Option

WithDisplayShadow .

func WithFontHinting

func WithFontHinting(val font.Hinting) Option

WithFontHinting .

func WithImageAlpha

func WithImageAlpha(val float32) Option

WithImageAlpha .

func WithImageSize

func WithImageSize(val option.Size) Option

WithImageSize .

func WithIsThumbNonDeformAbility

func WithIsThumbNonDeformAbility(val bool) Option

WithIsThumbNonDeformAbility .

func WithRangeAnglePos

func WithRangeAnglePos(vals []option.RangeVal) Option

WithRangeAnglePos .

func WithRangeColors

func WithRangeColors(colors []string) Option

WithRangeColors .

func WithRangeLen

func WithRangeLen(val option.RangeVal) Option

WithRangeLen .

func WithRangeSize

func WithRangeSize(val option.RangeVal) Option

WithRangeSize .

func WithRangeThumbBgCirclesNum

func WithRangeThumbBgCirclesNum(val int) Option

WithRangeThumbBgCirclesNum .

func WithRangeThumbBgColors

func WithRangeThumbBgColors(val []string) Option

WithRangeThumbBgColors .

func WithRangeThumbBgDistort

func WithRangeThumbBgDistort(val int) Option

WithRangeThumbBgDistort .

func WithRangeThumbBgSlimLineNum

func WithRangeThumbBgSlimLineNum(val int) Option

WithRangeThumbBgSlimLineNum .

func WithRangeThumbColors

func WithRangeThumbColors(val []string) Option

WithRangeThumbColors .

func WithRangeThumbImageSize

func WithRangeThumbImageSize(val option.Size) Option

WithRangeThumbImageSize .

func WithRangeThumbSize

func WithRangeThumbSize(val option.RangeVal) Option

WithRangeThumbSize .

func WithRangeVerifyLen

func WithRangeVerifyLen(val option.RangeVal) Option

WithRangeVerifyLen .

func WithShadowColor

func WithShadowColor(val string) Option

WithShadowColor .

func WithShadowPoint

func WithShadowPoint(val option.Point) Option

WithShadowPoint .

func WithThumbDisturbAlpha

func WithThumbDisturbAlpha(val float32) Option

WithThumbDisturbAlpha .

func WithUseShapeOriginalColor

func WithUseShapeOriginalColor(val bool) Option

WithUseShapeOriginalColor .

type Options

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

Options .

func NewOptions

func NewOptions() *Options

NewOptions .

func (*Options) GetDisabledRangeVerifyLen added in v2.0.1

func (o *Options) GetDisabledRangeVerifyLen() bool

GetDisabledRangeVerifyLen .

func (*Options) GetDisplayShadow

func (o *Options) GetDisplayShadow() bool

GetDisplayShadow .

func (*Options) GetImageAlpha

func (o *Options) GetImageAlpha() float32

GetImageAlpha .

func (*Options) GetImageSize

func (o *Options) GetImageSize() *option.Size

GetImageSize .

func (*Options) GetIsThumbNonDeformAbility

func (o *Options) GetIsThumbNonDeformAbility() bool

GetIsThumbNonDeformAbility .

func (*Options) GetRangeAnglePos

func (o *Options) GetRangeAnglePos() []*option.RangeVal

GetRangeAnglePos .

func (*Options) GetRangeColors

func (o *Options) GetRangeColors() []string

GetRangeColors .

func (*Options) GetRangeLen

func (o *Options) GetRangeLen() *option.RangeVal

GetRangeLen .

func (*Options) GetRangeSize

func (o *Options) GetRangeSize() *option.RangeVal

GetRangeSize .

func (*Options) GetRangeThumbBgColors

func (o *Options) GetRangeThumbBgColors() []string

GetRangeThumbBgColors .

func (*Options) GetRangeThumbColors

func (o *Options) GetRangeThumbColors() []string

GetRangeThumbColors .

func (*Options) GetRangeThumbSize

func (o *Options) GetRangeThumbSize() *option.RangeVal

GetRangeThumbSize .

func (*Options) GetRangeVerifyLen

func (o *Options) GetRangeVerifyLen() *option.RangeVal

GetRangeVerifyLen .

func (*Options) GetShadowColor

func (o *Options) GetShadowColor() string

GetShadowColor .

func (*Options) GetShadowPoint

func (o *Options) GetShadowPoint() *option.Point

GetShadowPoint .

func (*Options) GetThumbBgCirclesNum

func (o *Options) GetThumbBgCirclesNum() int

GetThumbBgCirclesNum .

func (*Options) GetThumbBgDistort

func (o *Options) GetThumbBgDistort() int

GetThumbBgDistort .

func (*Options) GetThumbBgSlimLineNum

func (o *Options) GetThumbBgSlimLineNum() int

GetThumbBgSlimLineNum .

func (*Options) GetThumbDisturbAlpha

func (o *Options) GetThumbDisturbAlpha() float32

GetThumbDisturbAlpha .

func (*Options) GetThumbImageSize

func (o *Options) GetThumbImageSize() *option.Size

GetThumbImageSize .

func (*Options) GetUseShapeOriginalColor

func (o *Options) GetUseShapeOriginalColor() bool

GetUseShapeOriginalColor .

type Resource

type Resource func(*Resources)

func WithBackgrounds

func WithBackgrounds(images []image.Image) Resource

WithBackgrounds is set background image

func WithChars

func WithChars(chars []string) Resource

WithChars is set characters

func WithFonts

func WithFonts(fonts []*truetype.Font) Resource

WithFonts is set font

func WithShapes

func WithShapes(shapeMaps map[string]image.Image) Resource

WithShapes is set shape

func WithThumbBackgrounds

func WithThumbBackgrounds(images []image.Image) Resource

WithThumbBackgrounds is set thumbnail background image

type Resources

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

func NewResources

func NewResources() *Resources

NewResources .

Jump to

Keyboard shortcuts

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