slide

package
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

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, padding int64) bool

CheckPoint is the position of the detection point

Types

type Block

type Block struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
	Angle  int `json:"angle"`
	TileX  int `json:"tile_x"`
	TileY  int `json:"tile_y"`
}

Block .

type Builder

type Builder interface {
	SetOptions(opts ...Option)
	SetResources(resources ...Resource)
	Clear()
	Make() Captcha
	MakeWithRegion() 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() *Block

GetData is to get block

func (CaptData) GetMasterImage

func (c CaptData) GetMasterImage() imagedata.JPEGImageData

GetMasterImage is to get master image

func (CaptData) GetTileImage

func (c CaptData) GetTileImage() imagedata.PNGImageData

GetTileImage is to get tile image

type Captcha

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

Captcha .

type CaptchaData

type CaptchaData interface {
	GetData() *Block
	GetMasterImage() imagedata.JPEGImageData
	GetTileImage() imagedata.PNGImageData
}

CaptchaData .

type DeadZoneDirectionType

type DeadZoneDirectionType int
const (
	DeadZoneDirectionTypeLeft DeadZoneDirectionType = iota
	DeadZoneDirectionTypeRight
	DeadZoneDirectionTypeTop
	DeadZoneDirectionTypeBottom
)

type DrawBlock

type DrawBlock struct {
	Block  *Block
	X      int
	Y      int
	Image  image.Image
	Width  int
	Height int
	Angle  int
}

DrawBlock .

type DrawImage

type DrawImage interface {
	DrawWithNRGBA(params *DrawImageParams) (img image.Image, bgImg image.Image, err error)
	DrawWithTemplate(params *DrawTplImageParams) (image.Image, error)
}

DrawImage .

func NewDrawImage

func NewDrawImage() DrawImage

NewDrawImage .

type DrawImageParams

type DrawImageParams struct {
	Width             int
	Height            int
	Background        image.Image
	Alpha             float32
	CaptchaDrawBlocks []*DrawBlock
}

DrawImageParams .

type DrawTplImageParams

type DrawTplImageParams struct {
	X                int
	Y                int
	Width            int
	Height           int
	Background       image.Image
	MaskImage        image.Image
	Alpha            float32
	CaptchaDrawBlock *DrawBlock
}

DrawTplImageParams .

type GraphImage

type GraphImage struct {
	OverlayImage image.Image
	ShadowImage  image.Image
	MaskImage    image.Image
}

GraphImage .

type Mode

type Mode int
const (
	ModeBasic Mode = iota
	ModeRegion
)

type Option

type Option func(*Options)

func WithEnableGraphVerticalRandom

func WithEnableGraphVerticalRandom(val bool) Option

WithEnableGraphVerticalRandom .

func WithGenGraphNumber

func WithGenGraphNumber(val int) Option

WithGenGraphNumber .

func WithImageAlpha

func WithImageAlpha(val float32) Option

WithImageAlpha .

func WithImageSize

func WithImageSize(val option.Size) Option

WithImageSize .

func WithRangeDeadZoneDirections

func WithRangeDeadZoneDirections(val []DeadZoneDirectionType) Option

WithRangeDeadZoneDirections .

func WithRangeGraphAnglePos

func WithRangeGraphAnglePos(vals []option.RangeVal) Option

WithRangeGraphAnglePos .

func WithRangeGraphSize

func WithRangeGraphSize(val option.RangeVal) Option

WithRangeGraphSize .

type Options

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

Options .

func NewOptions

func NewOptions() *Options

NewOptions .

func (*Options) GetImageAlpha

func (o *Options) GetImageAlpha() float32

GetImageAlpha .

func (*Options) GetImageSize

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

GetImageSize .

func (*Options) GetRangeDeadZoneDirections

func (o *Options) GetRangeDeadZoneDirections() []DeadZoneDirectionType

GetRangeDeadZoneDirections .

func (*Options) GetRangeGraphAnglePos

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

GetRangeGraphAnglePos .

func (*Options) GetRangeGraphSize

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

GetRangeGraphSize .

type Resource

type Resource func(*Resources)

func WithBackgrounds

func WithBackgrounds(images []image.Image) Resource

WithBackgrounds is set background image

func WithGraphImages

func WithGraphImages(images []*GraphImage) Resource

WithGraphImages is set graphic image

type Resources

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

Resources .

func NewResources

func NewResources() *Resources

NewResources .

Jump to

Keyboard shortcuts

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