Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CImage ¶
CImage is a image process tool
func CreateCImage ¶
func CreateCImage(config *ImageConfig) *CImage
CreateCImage will create a CImage struct with config
type CStore ¶
type CStore struct {
// contains filtered or unexported fields
}
CStore is the Captcha info store service
func CreateCStore ¶
CreateCStore will create a new CStore
func (*CStore) Add ¶
func (store *CStore) Add(captcha *CaptchaInfo) string
Add captcha info and get the auto generated key
type Captcha ¶
type Captcha struct {
// contains filtered or unexported fields
}
Captcha is the core captcha struct
func CreateCaptcha ¶
func CreateCaptcha(wordManager *WordManager, captchaConfig *CaptchaConfig, imageConfig *ImageConfig, filterConfig *FilterConfig) *Captcha
CreateCaptcha is a method to create new Captcha struct
type CaptchaConfig ¶
CaptchaConfig ,the captcha config
type CaptchaInfo ¶
CaptchaInfo is the entity of a captcha text:the content text,for the image display and user to recognize createTime:the time when the captcha is created
type FilterConfig ¶
type FilterConfig struct { EnableStrike bool EnableNoisePoint bool EnableNoiseLine bool StrikeLineNum int NoisePointNum int NoiseLineNum int }
FilterConfig ,the filter config
type FontManager ¶
type FontManager struct {
// contains filtered or unexported fields
}
FontManager is a Font Manager the manage font list
func CreateFontManager ¶
func CreateFontManager() *FontManager
CreateFontManager will create a new Font Manager
func (*FontManager) AddFont ¶
func (fm *FontManager) AddFont(pathToFontFile string) error
AddFont will add a new font file to the list
func (*FontManager) GetFont ¶
func (fm *FontManager) GetFont(pathToFontFile string) *truetype.Font
GetFont will return a Font struct by path
func (*FontManager) GetRandomFont ¶
func (fm *FontManager) GetRandomFont() *truetype.Font
GetRandomFont will return a random Font struct
type ImageConfig ¶
type ImageConfig struct { Width int Height int FontSize float64 FontFiles []string // contains filtered or unexported fields }
ImageConfig ,the image config
type ImageFilter ¶
type ImageFilter interface {
Proc(cimage *CImage)
}
ImageFilter is the interface of image filter
type ImageFilterBase ¶
type ImageFilterBase struct { }
ImageFilter is the base class of image filter
func (*ImageFilterBase) Proc ¶
func (filter *ImageFilterBase) Proc(cimage *CImage)
type ImageFilterManager ¶
type ImageFilterManager struct {
// contains filtered or unexported fields
}
ImageFilterManager
func CreateImageFilterManager ¶
func CreateImageFilterManager() *ImageFilterManager
func (*ImageFilterManager) AddFilter ¶
func (manager *ImageFilterManager) AddFilter(filter ImageFilter)
func (*ImageFilterManager) GetFilters ¶
func (manager *ImageFilterManager) GetFilters() []ImageFilter
type ImageFilterNoiseLine ¶
type ImageFilterNoiseLine struct { *ImageFilterBase NoiseLineNum int }
ImageFilter is the interface of image filter
func (*ImageFilterNoiseLine) Proc ¶
func (filter *ImageFilterNoiseLine) Proc(cimage *CImage)
Proc the image
type ImageFilterNoisePoint ¶
type ImageFilterNoisePoint struct { *ImageFilterBase NoisePointNum int }
ImageFilter is the interface of image filter
func (*ImageFilterNoisePoint) Proc ¶
func (filter *ImageFilterNoisePoint) Proc(cimage *CImage)
Proc the image
type ImageFilterStrike ¶
type ImageFilterStrike struct { *ImageFilterBase StrikeLineNum int }
ImageFilter is the interface of image filter
func (*ImageFilterStrike) Proc ¶
func (filter *ImageFilterStrike) Proc(cimage *CImage)
Proc the image
type WordManager ¶
type WordManager struct {
// contains filtered or unexported fields
}
WordManager is a captcha word manage tool
func (*WordManager) Get ¶
func (mgr *WordManager) Get(length int) string
Get a specifical length word
func (*WordManager) LoadFromFile ¶
func (mgr *WordManager) LoadFromFile(filename string) error
LoadFromFile is the loader func of word manager