Documentation ¶
Index ¶
- Constants
- Variables
- func CheckPoint(sx, sy, dx, dy, padding int64) bool
- type Block
- type Builder
- type CaptData
- type Captcha
- type CaptchaData
- type DeadZoneDirectionType
- type DrawBlock
- type DrawImage
- type DrawImageParams
- type DrawTplImageParams
- type GraphImage
- type Mode
- type Option
- func WithEnableGraphVerticalRandom(val bool) Option
- func WithGenGraphNumber(val int) Option
- func WithImageAlpha(val float32) Option
- func WithImageSize(val option.Size) Option
- func WithRangeDeadZoneDirections(val []DeadZoneDirectionType) Option
- func WithRangeGraphAnglePos(vals []option.RangeVal) Option
- func WithRangeGraphSize(val option.RangeVal) Option
- type Options
- type Resource
- type Resources
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 ¶
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 .
type CaptData ¶
type CaptData struct {
// contains filtered or unexported fields
}
CaptData .
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 DrawImage ¶
type DrawImage interface { DrawWithNRGBA(params *DrawImageParams) (img image.Image, bgImg image.Image, err error) DrawWithTemplate(params *DrawTplImageParams) (image.Image, error) }
DrawImage .
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 ¶
GraphImage .
type Option ¶
type Option func(*Options)
func WithEnableGraphVerticalRandom ¶
WithEnableGraphVerticalRandom .
func WithRangeDeadZoneDirections ¶
func WithRangeDeadZoneDirections(val []DeadZoneDirectionType) Option
WithRangeDeadZoneDirections .
func WithRangeGraphAnglePos ¶
WithRangeGraphAnglePos .
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options .
func (*Options) GetRangeDeadZoneDirections ¶
func (o *Options) GetRangeDeadZoneDirections() []DeadZoneDirectionType
GetRangeDeadZoneDirections .
func (*Options) GetRangeGraphAnglePos ¶
GetRangeGraphAnglePos .
func (*Options) GetRangeGraphSize ¶
GetRangeGraphSize .
type Resource ¶
type Resource func(*Resources)
func WithBackgrounds ¶
WithBackgrounds is to set background image
func WithGraphImages ¶
func WithGraphImages(images []*GraphImage) Resource
WithGraphImages is to set graphic image
Click to show internal directories.
Click to hide internal directories.