Documentation
¶
Index ¶
- Variables
- func CheckAngle(angle, dAngle, padding int64) booldeprecated
- func Validate(angle, dAngle, padding int) bool
- type Block
- type Builder
- type CaptData
- type Captcha
- type CaptchaData
- type DrawBlock
- type DrawCropCircleImageParams
- type DrawImage
- type DrawImageParams
- type Option
- type Options
- type Resource
- type Resources
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyImage = errors.New("no image")
var ErrImageType = errors.New("image must be is image.Image type")
Functions ¶
func CheckAngle
deprecated
Deprecated: As of 2.1.0, it will be removed, please use rotate.Validate
Types ¶
type Block ¶
type Block struct {
// Deprecated: As of 2.1.0, it will be removed, please use [[CaptchaInstance].GetOptions().GetImageSize()].
ParentWidth int `json:"parent_width"`
// Deprecated: As of 2.1.0, it will be removed, please use [[CaptchaInstance].GetOptions().GetImageSize()].
ParentHeight int `json:"parent_height"`
Width int `json:"width"`
Height int `json:"height"`
Angle int `json:"angle"`
}
Block ..
type Builder ¶
type Builder interface {
SetOptions(opts ...Option)
SetResources(resources ...Resource)
Clear()
Make() Captcha
}
Builder defines the interface for building rotate CAPTCHAs
func NewBuilder ¶
NewBuilder creates a new Builder instance params:
- opts: Optional initial options
return: Builder interface instance
type CaptData ¶
type CaptData struct {
// contains filtered or unexported fields
}
CaptData is the concrete implementation of the CaptchaData interface
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 defines the interface for rotate CAPTCHA
type CaptchaData ¶
type CaptchaData interface {
GetData() *Block
GetMasterImage() imagedata.PNGImageData
GetThumbImage() imagedata.PNGImageData
}
CaptchaData defines the interface for rotate CAPTCHA data
type DrawCropCircleImageParams ¶
type DrawCropCircleImageParams struct {
ScaleRatioSize int
Rotate int
SquareSize int
Background image.Image
Alpha float32
}
DrawCropCircleImageParams defines the parameters for drawing a cropped circle image
type DrawImage ¶
type DrawImage interface {
DrawWithNRGBA(params *DrawImageParams) (img image.Image, err error)
DrawWithCropCircle(params *DrawCropCircleImageParams) (image.Image, error)
}
DrawImage defines the interface for drawing images
func NewDrawImage ¶
func NewDrawImage() DrawImage
NewDrawImage creates a new DrawImage instance return: DrawImage interface instance
type DrawImageParams ¶
DrawImageParams defines the parameters for drawing the main image
type Option ¶
type Option func(*Options)
func WithRangeThumbImageSquareSize ¶
WithRangeThumbImageSquareSize .
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func (*Options) GetRangeAngle ¶
GetRangeAngle .
func (*Options) GetRangeThumbImageSquareSize ¶
GetRangeThumbImageSquareSize .
func (*Options) GetThumbImageAlpha ¶
GetThumbImageAlpha .