Documentation ¶
Index ¶
- Constants
- func Grayscale(src *image.NRGBA) *image.NRGBA
- func Noise(amount int, pxl image.Image, w, h int) *image.NRGBA64
- func SobelFilter(img *image.NRGBA, threshold float64) *image.NRGBA
- func StackBlur(img *image.NRGBA, radius uint32) *image.NRGBA
- type Delaunay
- type Drawer
- type Image
- type Line
- type Node
- type Point
- type Processor
- type SVG
- type Triangle
Constants ¶
const ( // WithoutWireframe - generates triangles without stroke WithoutWireframe = iota // WithWireframe - generates triangles with stroke WithWireframe // WireframeOnly - generates triangles only with wireframe WireframeOnly )
const PointRate = 0.875
PointRate defines the default point rate. Changing this value will modify the triangles sizes.
Variables ¶
This section is empty.
Functions ¶
func Noise ¶
Noise apply a noise factor, like adobe's grain filter to create a despeckle like image.
func SobelFilter ¶
SobelFilter detect image edges. See https://en.wikipedia.org/wiki/Sobel_operator
Types ¶
type Delaunay ¶
type Delaunay struct {
// contains filtered or unexported fields
}
Delaunay is the main entry struct which defines the delaunay system.
func (*Delaunay) GetTriangles ¶
GetTriangles return the generated triangles.
type Drawer ¶ added in v1.0.2
Drawer interface which defines the Draw method. This method needs to be implemented by every struct which defines a Draw method. This is meant for code reusing and modularity. In our case the image can be triangulated as raster image or SVG.
type Image ¶ added in v1.0.2
type Image struct {
Processor
}
Image extends the Processor struct.
func (*Image) Draw ¶ added in v1.0.2
func (im *Image) Draw(input io.Reader, output io.Writer, closure func()) ([]Triangle, []Point, error)
Draw triangulate the source image and output the result to an image file. It returns the number of triangles generated, the number of points and the error in case exists.
type Node ¶
type Node struct {
X, Y int
}
Node struct having as components the node X and Y coordinate position.
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Point defines a struct having as components the point X and Y coordinate position.
type Processor ¶
type Processor struct { BlurRadius int SobelThreshold int PointsThreshold int MaxPoints int Wireframe int Noise int StrokeWidth float64 IsSolid bool Grayscale bool OutputToSVG bool OutputInWeb bool }
Processor type with processing options
type SVG ¶ added in v1.0.2
type SVG struct { Width int Height int Title string Lines []Line Color color.RGBA Description string StrokeLineCap string StrokeWidth float64 Processor }
SVG extends the Processor struct with the SVG parameters.
func (*SVG) Draw ¶ added in v1.0.2
func (svg *SVG) Draw(input io.Reader, output io.Writer, closure func()) ([]Triangle, []Point, error)
Draw triangulate the source image and output the result to an SVG file. It returns the number of triangles generated, the number of points and the error in case exists.