Documentation ¶
Overview ¶
Package svg provides methods for working with fingerprint SVG documents.
Index ¶
- Constants
- func DerivePathType(d string) string
- func Draw(dc *gg.Context, coords Coordinates, color string, scale float64) error
- func DrawCubic(dc *gg.Context, curves Cubic, color string, scale float64) error
- func DrawLine(dc *gg.Context, points Line, color string, scale float64) error
- type Coordinates
- type Cubic
- type Document
- type Line
- type Path
- type Point
Constants ¶
const CUBIC string = "C"
CUBIC is the string identifier for a `Cubic` path.
const LINE string = "L"
LINE is the string identifier for a `Line` path.
const MISSING string = "X"
MISSING is a the string identifier for a path that can not be parsed.
const POINT string = "P"
POINT is the string identifier for a `Point`.
const UNKNOWN string = ""
UNKNOWN is a the string identifier for a path type that is not supported.
Variables ¶
This section is empty.
Functions ¶
func DerivePathType ¶ added in v0.0.6
DerivePathType returns a string identifier for the SVG path (`d` attribute) defined by 'd'.
Types ¶
type Coordinates ¶ added in v0.0.6
type Coordinates interface {
Type() string
}
Coordinate is an interface representation the coordinates defined by a `Path` instance.
func DeriveCoordinates ¶ added in v0.0.6
func DeriveCoordinates(d string) (Coordinates, error)
DerivePathType returns a `Coordinates` instance derived from the SVG path (`d` attribute) defined by 'd'.
type Cubic ¶ added in v0.0.6
type Cubic [][3]Point
Cubic is a list of a tuples of `Point` instances that make up a cubic curve path.
type Document ¶
type Document struct { // Width is the width of the fingerprint SVG drawing. Width int `xml:"width,attr" json:"width"` // Height is the width of the fingerprint SVG drawing. Height int `xml:"height,attr" json:"height"` // ViewBox is the viewbox boundary of the fingerprint SVG drawing. ViewBox string `xml:"viewBox,attr" json:"viewbox"` // Date is the date that a fingerprint SVG drawing was produced. Date string `xml:"x-fingerprint-date,attr" json:"date"` // Paths is the list of SVG path that define a fingerprint SVG drawing. Paths []*Path `xml:"path" json:"paths"` }
Document defines a struct representing a fingerprint SVG document. At this time it is not
type Line ¶ added in v0.0.6
type Line []Point
Line is a list of pairs of `Point` instances that make up a line path.
type Path ¶
type Path struct { // Fill is the colour assigned to the path. Fill string `xml:"fill,attr" json:"f"` // FillOpacity is the opacity of the colour (assigned to the path). FillOpacity float64 `xml:"fill-opacity,attr" json:"o"` // D is the SVG-encoded value of the path. D string `xml:"d,attr" json:"d"` }
Path is a struct representing an individual path element in a fingerprint SVG drawing.
func (*Path) Coordinates ¶
func (p *Path) Coordinates() (Coordinates, error)
Coodinates with return a `Coordinates` instance derived derived from the `D` property of 'p'.