Documentation ¶
Index ¶
- Variables
- func CheckPoint(sx, sy, dx, dy, width, height, padding int64) bool
- type Builder
- type CaptData
- type Captcha
- type CaptchaData
- type Dot
- type DrawDot
- type DrawImage
- type DrawImageParams
- type DrawType
- type Mode
- type Option
- func WithDisabledRangeVerifyLen(disabled bool) Option
- func WithDisplayShadow(val bool) Option
- func WithFontHinting(val font.Hinting) Option
- func WithImageAlpha(val float32) Option
- func WithImageSize(val option.Size) Option
- func WithIsThumbNonDeformAbility(val bool) Option
- func WithRangeAnglePos(vals []option.RangeVal) Option
- func WithRangeColors(colors []string) Option
- func WithRangeLen(val option.RangeVal) Option
- func WithRangeSize(val option.RangeVal) Option
- func WithRangeThumbBgCirclesNum(val int) Option
- func WithRangeThumbBgColors(val []string) Option
- func WithRangeThumbBgDistort(val int) Option
- func WithRangeThumbBgSlimLineNum(val int) Option
- func WithRangeThumbColors(val []string) Option
- func WithRangeThumbImageSize(val option.Size) Option
- func WithRangeThumbSize(val option.RangeVal) Option
- func WithRangeVerifyLen(val option.RangeVal) Option
- func WithShadowColor(val string) Option
- func WithShadowPoint(val option.Point) Option
- func WithThumbDisturbAlpha(val float32) Option
- func WithUseShapeOriginalColor(val bool) Option
- type Options
- func (o *Options) GetDisabledRangeVerifyLen() bool
- func (o *Options) GetDisplayShadow() bool
- func (o *Options) GetImageAlpha() float32
- func (o *Options) GetImageSize() *option.Size
- func (o *Options) GetIsThumbNonDeformAbility() bool
- func (o *Options) GetRangeAnglePos() []*option.RangeVal
- func (o *Options) GetRangeColors() []string
- func (o *Options) GetRangeLen() *option.RangeVal
- func (o *Options) GetRangeSize() *option.RangeVal
- func (o *Options) GetRangeThumbBgColors() []string
- func (o *Options) GetRangeThumbColors() []string
- func (o *Options) GetRangeThumbSize() *option.RangeVal
- func (o *Options) GetRangeVerifyLen() *option.RangeVal
- func (o *Options) GetShadowColor() string
- func (o *Options) GetShadowPoint() *option.Point
- func (o *Options) GetThumbBgCirclesNum() int
- func (o *Options) GetThumbBgDistort() int
- func (o *Options) GetThumbBgSlimLineNum() int
- func (o *Options) GetThumbDisturbAlpha() float32
- func (o *Options) GetThumbImageSize() *option.Size
- func (o *Options) GetUseShapeOriginalColor() bool
- type Resource
- type Resources
Constants ¶
This section is empty.
Variables ¶
var ErrCharLen = errors.New("the char length must be less than or equal to 2")
var ErrCharRangeLen = errors.New("character length must be large than to 'rangeLen.Max'")
var ErrChineseCharLen = errors.New("the chinese char length must be equal to 1")
var ErrColorLen = errors.New("the color length must be less than or equal to 255")
var ErrEmptyBackgroundImage = errors.New("no background image")
var ErrEmptyCharacter = errors.New("empty character")
var ErrEmptyShapes = errors.New("empty shapes")
var ErrModeSupport = errors.New("mode not supported")
var ErrRangeVerifyLen = errors.New("the max value of 'rangeVerifyLen' must be less than or equal to the min value of 'rangeLen'")
var ErrShapesRangeLen = errors.New("total number of shapes must be large than to 'rangeLen.Max'")
var ErrShapesType = errors.New("shape must be is image type")
Functions ¶
func CheckPoint ¶
CheckPoint is to the position of the detection point
Types ¶
type Builder ¶
type Builder interface { SetOptions(opts ...Option) SetResources(resources ...Resource) Clear() Make() Captcha MakeWithShape() 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) 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) }
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 Option ¶
type Option func(*Options)
func WithDisabledRangeVerifyLen ¶
WithDisabledRangeVerifyLen .
func WithIsThumbNonDeformAbility ¶
WithIsThumbNonDeformAbility .
func WithRangeThumbBgCirclesNum ¶
WithRangeThumbBgCirclesNum .
func WithRangeThumbBgColors ¶
WithRangeThumbBgColors .
func WithRangeThumbBgDistort ¶
WithRangeThumbBgDistort .
func WithRangeThumbBgSlimLineNum ¶
WithRangeThumbBgSlimLineNum .
func WithRangeThumbImageSize ¶
WithRangeThumbImageSize .
func WithUseShapeOriginalColor ¶
WithUseShapeOriginalColor .
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options .
func (*Options) GetDisabledRangeVerifyLen ¶
GetDisabledRangeVerifyLen .
func (*Options) GetIsThumbNonDeformAbility ¶
GetIsThumbNonDeformAbility .
func (*Options) GetRangeAnglePos ¶
GetRangeAnglePos .
func (*Options) GetRangeThumbBgColors ¶
GetRangeThumbBgColors .
func (*Options) GetRangeThumbColors ¶
GetRangeThumbColors .
func (*Options) GetRangeThumbSize ¶
GetRangeThumbSize .
func (*Options) GetRangeVerifyLen ¶
GetRangeVerifyLen .
func (*Options) GetThumbBgCirclesNum ¶
GetThumbBgCirclesNum .
func (*Options) GetThumbBgSlimLineNum ¶
GetThumbBgSlimLineNum .
func (*Options) GetThumbDisturbAlpha ¶
GetThumbDisturbAlpha .
func (*Options) GetThumbImageSize ¶
GetThumbImageSize .
func (*Options) GetUseShapeOriginalColor ¶
GetUseShapeOriginalColor .
type Resource ¶
type Resource func(*Resources)
func WithBackgrounds ¶
WithBackgrounds is to set background image
func WithShapes ¶
WithShapes is to set shape
func WithThumbBackgrounds ¶
WithThumbBackgrounds is to set thumbnail background image