Documentation
¶
Index ¶
- func GaussianBlur(src image.Image, sigma float64) *image.RGBA
- func GaussianBlurKernel1D(sigma float64) *convolution.Kernel
- type Cmds
- type Params
- func NewBlur(rect image.Rectangle, blurRadius float32) *Params
- func NewClear(src image.Image, sp image.Point, op draw.Op) *Params
- func NewDraw(rect image.Rectangle, src image.Image, sp image.Point, op draw.Op) *Params
- func NewDrawMask(rect image.Rectangle, src image.Image, sp image.Point, op draw.Op, ...) *Params
- func NewSetPixel(at image.Point, clr image.Image) *Params
- func NewTransform(m math32.Matrix2, rect image.Rectangle, src image.Image, op draw.Op) *Params
- func NewTransformMask(m math32.Matrix2, rect image.Rectangle, src image.Image, op draw.Op, ...) *Params
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GaussianBlur ¶
GaussianBlur returns a smoothly blurred version of the image using a Gaussian function. Sigma is the standard deviation of the Gaussian function, and a kernel of radius = 4 * Sigma is used.
func GaussianBlurKernel1D ¶
func GaussianBlurKernel1D(sigma float64) *convolution.Kernel
GaussianBlurKernel1D returns a 1D Gaussian kernel. Sigma is the standard deviation, and the radius of the kernel is 4 * sigma.
Types ¶
type Cmds ¶
type Cmds int32 //enums:enum
Cmds are possible commands to perform for Params.
const ( // Draw Source image using draw.Draw equivalent function, // without any transformation. If Mask is non-nil it is used. Draw Cmds = iota // Draw Source image with transform. If Mask is non-nil, it is used. Transform // blurs the Rect region with the given blur radius. // The blur radius passed to this function is the actual Gaussian // standard deviation (σ). Blur // Sets pixel from Source image at Pos SetPixel )
const CmdsN Cmds = 4
CmdsN is the highest valid value for type Cmds, plus one.
func CmdsValues ¶
func CmdsValues() []Cmds
CmdsValues returns all possible values for the type Cmds.
func (Cmds) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Cmds) SetString ¶
SetString sets the Cmds value from its string representation, and returns an error if the string is invalid.
func (*Cmds) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Params ¶
type Params struct {
// Command to perform.
Cmd Cmds
// Rect is the rectangle to draw into. This is the bounds for Transform source.
// If empty, the entire destination image Bounds() are used.
Rect image.Rectangle
// SourcePos is the position for the source image in Draw,
// and the location for SetPixel.
SourcePos image.Point
// Draw operation: Src or Over
Op draw.Op
// Source to draw.
Source image.Image
// Mask, used if non-nil.
Mask image.Image
// MaskPos is the position for the mask
MaskPos image.Point
// Transform for image transform.
Transform math32.Matrix2
// BlurRadius is the Gaussian standard deviation for Blur function
BlurRadius float32
}
Params for image operations. This is a Render Item.
func NewBlur ¶
NewBlur returns a new Blur operation with given parameters. Does nothing if rect is empty.
func NewDraw ¶
NewDraw returns a new Draw operation with given parameters. Does nothing if rect is empty.
func NewDrawMask ¶
func NewDrawMask(rect image.Rectangle, src image.Image, sp image.Point, op draw.Op, mask image.Image, mp image.Point) *Params
NewDrawMask returns a new DrawMask operation with given parameters. Does nothing if rect is empty.
func NewSetPixel ¶
NewSetPixel returns a new SetPixel operation with given parameters.
func NewTransform ¶
NewTransform returns a new Transform operation with given parameters. Does nothing if rect is empty.
func NewTransformMask ¶
func NewTransformMask(m math32.Matrix2, rect image.Rectangle, src image.Image, op draw.Op, mask image.Image, mp image.Point) *Params
NewTransformMask returns a new Transform Mask operation with given parameters. Does nothing if rect is empty.
func (*Params) IsRenderItem ¶
func (pr *Params) IsRenderItem()