slide

package
v2.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Version = "2.0.2"

Version # of captcha

Variables

View Source
var EmptyBackgroundImageErr = errors.New("no background image")
View Source
var GenerateDataErr = errors.New("generate data failed")
View Source
var GraphImageErr = errors.New("graph image is incorrect")
View Source
var ImageTypeErr = errors.New("tile image must be is image.Image type")
View Source
var MaskImageTypeErr = errors.New("tile shadow image must be is image.Image type")
View Source
var ShadowImageTypeErr = errors.New("tile shadow image must be is image.Image type")

Functions

func CheckPoint

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

CheckPoint is to 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 to set background image

func WithGraphImages

func WithGraphImages(images []*GraphImage) Resource

WithGraphImages is to 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