graphics

package
v0.0.0-...-ce07192 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultStdDev = 0.5

DefaultStdDev is the default blurring parameter.

View Source
var I = Affine{
	1, 0, 0,
	0, 1, 0,
	0, 0, 1,
}

I is the identity Affine transform matrix.

Functions

func Blur

func Blur(dst draw.Image, src image.Image, opt *BlurOptions) error

Blur produces a blurred version of the image, using a Gaussian blur.

func Rotate

func Rotate(dst draw.Image, src image.Image, opt *RotateOptions) error

Rotate produces a rotated version of src, drawn onto dst.

func Scale

func Scale(dst draw.Image, src image.Image) error

Scale produces a scaled version of the image using bilinear interpolation.

func Thumbnail

func Thumbnail(dst draw.Image, src image.Image) error

Thumbnail scales and crops src so it fits in dst.

Types

type Affine

type Affine [9]float64

Affine is a 3x3 2D affine transform matrix. M(i,j) is Affine[i*3+j].

func (Affine) Center

func (a Affine) Center(x, y float64) Affine

Center produces the affine transform, centered around the provided point.

func (Affine) CenterFit

func (a Affine) CenterFit(dst, src image.Rectangle) Affine

CenterFit produces the affine transform, centered around the rectangles. It is equivalent to

I.Translate(-<center of src>).Mul(a).Translate(<center of dst>)

func (Affine) Mul

func (a Affine) Mul(b Affine) Affine

Mul returns the multiplication of two affine transform matrices.

func (Affine) Rotate

func (a Affine) Rotate(angle float64) Affine

Rotate produces a clockwise rotation transform of angle, in radians.

func (Affine) Scale

func (a Affine) Scale(x, y float64) Affine

Scale produces a scaling transform of factors x and y.

func (Affine) Shear

func (a Affine) Shear(x, y float64) Affine

Shear produces a shear transform by the slopes x and y.

func (Affine) Transform

func (a Affine) Transform(dst draw.Image, src image.Image, i interp.Interp) error

Transform applies the affine transform to src and produces dst.

func (Affine) TransformCenter

func (a Affine) TransformCenter(dst draw.Image, src image.Image, i interp.Interp) error

TransformCenter applies the affine transform to src and produces dst. Equivalent to

a.CenterFit(dst, src).Transform(dst, src, i).

func (Affine) Translate

func (a Affine) Translate(x, y float64) Affine

Translate produces a translation transform with pixel distances x and y.

type BlurOptions

type BlurOptions struct {
	StdDev float64
	Size   int
}

BlurOptions are the blurring parameters. StdDev is the standard deviation of the normal, higher is blurrier. Size is the size of the kernel. If zero, it is set to Ceil(6 * StdDev).

type RotateOptions

type RotateOptions struct {
	Angle float64
}

RotateOptions are the rotation parameters. Angle is the angle, in radians, to rotate the image clockwise.

Directories

Path Synopsis
Package detect implements an object detector cascade.
Package detect implements an object detector cascade.
Package interp implements image interpolation.
Package interp implements image interpolation.

Jump to

Keyboard shortcuts

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