Versions in this module Expand all Collapse all v0 v0.0.1 Jan 2, 2024 Changes in this version + const DistortLevel1 + const DistortLevel2 + const DistortLevel3 + const DistortLevel4 + const DistortLevel5 + const DistortNone + const QualityCompressLevel1 + const QualityCompressLevel2 + const QualityCompressLevel3 + const QualityCompressLevel4 + const QualityCompressLevel5 + const QualityCompressNone + func Check(recorded map[int]CharDot, postDots string) bool + func CheckPointDist(sx, sy, dx, dy, width, height int64) bool + func CheckPointDistWithPadding(sx, sy, dx, dy, width, height, padding int64) bool + func Child(path string) ([]string, error) + func ClearAssetCacheWithPaths(paths []string) bool + func EncodeB64stringWithJpeg(img image.Image, quality int) (string, error) + func EncodeB64stringWithPng(img image.Image) (string, error) + func GenUniqueId() string + func GetCaptchaDefaultChars() *[]string + func HexToRgb(hex string) (int64, int64, int64) + func InArrayWithStr(items []string, s string) bool + func IsChineseChar(str string) bool + func LenChineseChar(str string) int + func Md5ToString(str string) string + func ParseHexColor(s string) (c color.RGBA, err error) + func PathExists(path string) (bool, error) + func RandFloat(min, max int) float64 + func RandInt(min, max int) int + func RgbToHex(red int64, green int64, blue int64) string + func Sup(i int64, n int) string + type AreaPoint struct + MaxX int + MaxY int + MinX int + MinY int + type Captcha struct + func GetCaptcha() *Captcha + func NewCaptcha() *Captcha + func (cc *Captcha) ClearAssetCacheWithPaths(paths []string) bool + func (cc *Captcha) EncodeB64stringWithJpeg(img image.Image) (string, error) + func (cc *Captcha) EncodeB64stringWithPng(img image.Image) (string, error) + func (cc *Captcha) Generate() (map[int]CharDot, string, string, string, error) + func (cc *Captcha) GenerateWithSize(imageSize Size, thumbnailSize Size) (map[int]CharDot, string, string, string, error) + func (cc *Captcha) SetBackground(images []string, args ...bool) + func (cc *Captcha) SetFont(fonts []string, args ...bool) + func (cc *Captcha) SetFontDPI(val int) + func (cc *Captcha) SetFontHinting(val font.Hinting) + func (cc *Captcha) SetImageFontAlpha(val float64) + func (cc *Captcha) SetImageFontDistort(val int) + func (cc *Captcha) SetImageQuality(val int) + func (cc *Captcha) SetImageSize(size Size) + func (cc *Captcha) SetRangChars(chars []string) error + func (cc *Captcha) SetRangCheckFontSize(val RangeVal) + func (cc *Captcha) SetRangCheckTextLen(val RangeVal) + func (cc *Captcha) SetRangFontSize(val RangeVal) + func (cc *Captcha) SetTextRangAnglePos(pos []RangeVal) + func (cc *Captcha) SetTextRangFontColors(colors []string) + func (cc *Captcha) SetTextRangLen(val RangeVal) + func (cc *Captcha) SetTextShadow(val bool) + func (cc *Captcha) SetTextShadowColor(val string) + func (cc *Captcha) SetTextShadowPoint(val Point) + func (cc *Captcha) SetThumbBackground(images []string, args ...bool) + func (cc *Captcha) SetThumbBgCirclesNum(val int) + func (cc *Captcha) SetThumbBgColors(colors []string) + func (cc *Captcha) SetThumbBgDistort(val int) + func (cc *Captcha) SetThumbBgSlimLineNum(val int) + func (cc *Captcha) SetThumbFontDistort(val int) + func (cc *Captcha) SetThumbSize(size Size) + func (cc *Captcha) SetThumbTextRangFontColors(colors []string) + type CharDot struct + Angle int + Color string + Color2 string + Dx int + Dy int + Height int + Index int + Size int + Text string + Width int + type Config struct + func GetCaptchaDefaultConfig() *Config + type Draw struct + func (cd *Draw) CreateCanvas(params DrawCanvas, isAlpha bool) (img *image.NRGBA) + func (cd *Draw) CreateCanvasWithPalette(params DrawCanvas, colorArr []color.RGBA) *Palette + func (cd *Draw) Draw(params DrawCanvas) (image.Image, error) + func (cd *Draw) DrawStrImg(dot DrawDot, colorArr []color.RGBA, fc color.Color) (*Palette, error) + func (cd *Draw) DrawTextImg(dot DrawDot, params DrawCanvas) (*Palette, *AreaPoint, error) + func (cd *Draw) DrawWithPalette(params DrawCanvas, colorA []color.Color, colorB []color.Color) (image.Image, error) + type DrawCanvas struct + Background string + BackgroundCirclesNum int + BackgroundDistort int + BackgroundSlimLineNum int + CaptchaDrawDot []DrawDot + FontHinting font.Hinting + Height int + ShowTextShadow bool + TextAlpha float64 + TextShadowColor string + TextShadowPoint Point + Width int + type DrawDot struct + Angle int + Color string + Color2 string + Dx int + Dy int + Font string + FontDPI int + Height int + Size int + Text string + Width int + type Palette struct + func NewPalette(r image.Rectangle, p color.Palette) *Palette + func (p *Palette) Rotate(angle int) + type Point struct + X int + Y int + type RangeVal struct + Max int + Min int + type Size struct + Height int + Width int