chinese

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFont

func GetFont() *truetype.Font

GetFont returns the Chinese font (wqy-microhei). Font is loaded lazily on first call.

Types

type Driver

type Driver struct {
	//Height png height in pixel.
	Height int
	//Width Captcha png width in pixel.
	Width int

	//NoiseCount text noise count.
	NoiseCount int

	//ShowLineOptions := OptionShowHollowLine | OptionShowSlimeLine | OptionShowSineLine .
	ShowLineOptions int

	//Length random string length.
	Length int

	//Source is a unicode which is the rand string from.
	Source string

	//BgColor captcha image background color (optional)
	BgColor *color.RGBA

	//Fonts list of font names to use
	Fonts []string
	// contains filtered or unexported fields
}

Driver is a driver of unicode Chinese characters.

func NewDriver

func NewDriver(height int, width int, noiseCount int, showLineOptions int, length int, source string, bgColor *color.RGBA, fonts []string) *Driver

NewDriver creates a driver of Chinese characters

func (*Driver) DrawCaptcha

func (d *Driver) DrawCaptcha(content string) (item base64Captcha.Item, err error)

DrawCaptcha generates captcha item(image)

func (*Driver) GenerateIdQuestionAnswer

func (d *Driver) GenerateIdQuestionAnswer() (id, content, answer string)

GenerateIdQuestionAnswer generates captcha content and its answer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL