captchautil

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomLightColor

func RandomLightColor() color.RGBA

RandomLightColor returns a random light color.

func RandomText

func RandomText(n int) (string, error)

RandomText returns a generated string in given number of random characters.

Types

type Complexity

type Complexity int
const (
	ComplexityLow Complexity = iota
	ComplexityMedium
	ComplexityHigh
)

type Image

type Image struct {
	// contains filtered or unexported fields
}

Image is a captcha image.

func CreateImage

func CreateImage(width, height, dpi int, bgColor color.RGBA, opts ...Option) (*Image, error)

CreateImage creates and returns a new image with given width, height, DPI, background color and additional options.

func (*Image) Encode

func (img *Image) Encode(w io.Writer) error

Encode encodes the final JPEG image to the given writer.

type Option

type Option func(*Image) error

func Border

func Border(color color.RGBA) Option

Border draws border on the image.

func Curve

func Curve() Option

Curve draws a curve on the image.

func Noise

func Noise(complex Complexity) Option

Noise draws background noise on the image.

func Text

func Text(text string) Option

Text draws text on the image.

func TextNoise

func TextNoise(complex Complexity) Option

TextNoise draws background text noise on the image.

Jump to

Keyboard shortcuts

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