rotate

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyImage = errors.New("no image")
View Source
var ErrImageType = errors.New("image must be is image.Image type")

Functions

func CheckAngle

func CheckAngle(angle, dAngle, padding int64) bool

CheckAngle is to the detection angle

Types

type Block

type Block struct {
	ParentWidth  int `json:"parent_width"`
	ParentHeight int `json:"parent_height"`
	Width        int `json:"width"`
	Height       int `json:"height"`
	Angle        int `json:"angle"`
}

type Builder

type Builder interface {
	SetOptions(opts ...Option)
	SetResources(resources ...Resource)
	Clear()
	Make() Captcha
}

Builder .

func NewBuilder

func NewBuilder(opts ...Option) Builder

NewBuilder .

type CaptData

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

CaptData .

func (CaptData) GetData

func (c CaptData) GetData() *Block

GetData is to get block

func (CaptData) GetMasterImage

func (c CaptData) GetMasterImage() imagedata.PNGImageData

GetMasterImage is to get master image

func (CaptData) GetThumbImage

func (c CaptData) GetThumbImage() imagedata.PNGImageData

GetThumbImage is to get thumb image

type Captcha

type Captcha interface {
	GetOptions() *Options
	Generate() (CaptchaData, error)
	// contains filtered or unexported methods
}

Captcha .

type CaptchaData

type CaptchaData interface {
	GetData() *Block
	GetMasterImage() imagedata.PNGImageData
	GetThumbImage() imagedata.PNGImageData
}

CaptchaData .

type DrawBlock

type DrawBlock struct {
	Block  *Block
	X      int
	Y      int
	Width  int
	Height int
	Angle  int
}

DrawBlock .

type DrawCropCircleImageParams

type DrawCropCircleImageParams struct {
	ScaleRatioSize int
	Rotate         int
	SquareSize     int
	Background     image.Image
	Alpha          float32
}

DrawCropCircleImageParams .

type DrawImage

type DrawImage interface {
	DrawWithNRGBA(params *DrawImageParams) (img image.Image, err error)
	DrawWithCropCircle(params *DrawCropCircleImageParams) (image.Image, error)
}

DrawImage .

func NewDrawImage

func NewDrawImage() DrawImage

NewDrawImage .

type DrawImageParams

type DrawImageParams struct {
	Rotate     int
	SquareSize int
	Background image.Image
	Alpha      float32
}

DrawImageParams .

type Option

type Option func(*Options)

func WithImageSquareSize

func WithImageSquareSize(val int) Option

WithImageSquareSize .

func WithRangeAnglePos

func WithRangeAnglePos(vals []option.RangeVal) Option

WithRangeAnglePos .

func WithRangeThumbImageSquareSize

func WithRangeThumbImageSquareSize(val []int) Option

WithRangeThumbImageSquareSize .

func WithThumbImageAlpha

func WithThumbImageAlpha(val float32) Option

WithThumbImageAlpha .

type Options

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

func NewOptions

func NewOptions() *Options

NewOptions .

func (*Options) GetImageSize

func (o *Options) GetImageSize() int

GetImageSize .

func (*Options) GetRangeAngle

func (o *Options) GetRangeAngle() []*option.RangeVal

GetRangeAngle .

func (*Options) GetRangeThumbImageSquareSize

func (o *Options) GetRangeThumbImageSquareSize() []int

GetRangeThumbImageSquareSize .

func (*Options) GetThumbImageAlpha

func (o *Options) GetThumbImageAlpha() float32

GetThumbImageAlpha .

type Resource

type Resource func(*Resources)

func WithImages

func WithImages(images []image.Image) Resource

WithImages is to set image

type Resources

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

Resources .

func NewResources

func NewResources() *Resources

NewResources .

Jump to

Keyboard shortcuts

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