svgo: github.com/ajstarks/svgo Index | Files | Directories

package svg

import "github.com/ajstarks/svgo"

Package svg generates SVG as defined by the Scalable Vector Graphics 1.1 Specification (<http://www.w3.org/TR/SVG11/>). Output goes to the specified io.Writer.

Supported SVG elements and functions

Shapes, lines, text

circle, ellipse, polygon, polyline, rect (including roundrects), line, text

Paths

general, arc, cubic and quadratic bezier paths,

Image and Gradients

image, linearGradient, radialGradient,

Transforms

translate, rotate, scale, skewX, skewY

Filter Effects

filter, feBlend, feColorMatrix, feColorMatrix, feComponentTransfer, feComposite, feConvolveMatrix, feDiffuseLighting,
feDisplacementMap, feDistantLight, feFlood, feGaussianBlur, feImage, feMerge, feMorphology, feOffset, fePointLight,
feSpecularLighting, feSpotLight,feTile, feTurbulence

Metadata elements

desc, defs, g (style, transform, id), mask, marker, pattern, title, (a)ddress, link, script, style, use

Usage: (assuming GOPATH is set)

go get github.com/ajstarks/svgo
go install github.com/ajstarks/svgo/...

You can use godoc to browse the documentation from the command line:

$ godoc github.com/ajstarks/svgo

a minimal program, to generate SVG to standard output.

package main

import (
	"github.com/ajstarks/svgo"
	"os"
)

func main() {
	width := 500
	height := 500
	canvas := svg.New(os.Stdout)
	canvas.Start(width, height)
	canvas.Circle(width/2, height/2, 100)
	canvas.Text(width/2, height/2, "Hello, SVG", "text-anchor:middle;font-size:30px;fill:white")
	canvas.End()
}

Drawing in a web server: (http://localhost:2003/circle)

package main

import (
	"log"
	"github.com/ajstarks/svgo"
	"net/http"
)

func main() {
	http.Handle("/circle", http.HandlerFunc(circle))
	err := http.ListenAndServe(":2003", nil)
	if err != nil {
		log.Fatal("ListenAndServe:", err)
	}
}

func circle(w http.ResponseWriter, req *http.Request) {
  w.Header().Set("Content-Type", "image/svg+xml")
  s := svg.New(w)
  s.Start(500, 500)
  s.Circle(250, 250, 125, "fill:none;stroke:black")
  s.End()
}

Functions and types

Many functions use x, y to specify an object's location, and w, h to specify the object's width and height. Where applicable, a final optional argument specifies the style to be applied to the object. The style strings follow the SVG standard; name:value pairs delimited by semicolons, or a series of name="value" pairs. For example: `"fill:none; opacity:0.3"` or `fill="none" opacity="0.3"` (see: <http://www.w3.org/TR/SVG11/styling.html>)

The SVG type:

	type SVG struct {
        Writer   io.Writer
	}

Most operations are methods on this type, specifying the destination io.Writer.

The Offcolor type:

type Offcolor struct {
	Offset  uint8
	Color   string
	Opacity float64
}

is used to specify the offset, color, and opacity of stop colors in linear and radial gradients

The Filterspec type:

type Filterspec struct {
	In string
	In2 string
	Result string
}

is used to specify inputs and results for filter effects

Package svg provides an API for generating Scalable Vector Graphics (SVG)

Index

Package Files

doc.go svg.go

type Filterspec Uses

type Filterspec struct {
    In, In2, Result string
}

Filterspec defines the specification of SVG filters

type Offcolor Uses

type Offcolor struct {
    Offset  uint8
    Color   string
    Opacity float64
}

Offcolor defines the offset and color for gradients

type SVG Uses

type SVG struct {
    Writer io.Writer
}

SVG defines the location of the generated SVG

func New Uses

func New(w io.Writer) *SVG

New is the SVG constructor, specifying the io.Writer where the generated SVG is written.

func (*SVG) Animate Uses

func (svg *SVG) Animate(link, attr string, from, to int, duration float64, repeat int, s ...string)

Animate animates the specified link, using the specified attribute The animation starts at coordinate from, terminates at to, and repeats as specified

func (*SVG) AnimateMotion Uses

func (svg *SVG) AnimateMotion(link, path string, duration float64, repeat int, s ...string)

AnimateMotion animates the referenced object along the specified path

func (*SVG) AnimateRotate Uses

func (svg *SVG) AnimateRotate(link string, fs, fc, fe, ts, tc, te int, duration float64, repeat int, s ...string)

AnimateRotate animates the rotation transformation

func (*SVG) AnimateScale Uses

func (svg *SVG) AnimateScale(link string, from, to, duration float64, repeat int, s ...string)

AnimateScale animates the scale transformation

func (*SVG) AnimateSkewX Uses

func (svg *SVG) AnimateSkewX(link string, from, to, duration float64, repeat int, s ...string)

AnimateSkewX animates the skewX transformation

func (*SVG) AnimateSkewY Uses

func (svg *SVG) AnimateSkewY(link string, from, to, duration float64, repeat int, s ...string)

AnimateSkewY animates the skewY transformation

func (*SVG) AnimateTransform Uses

func (svg *SVG) AnimateTransform(link, ttype, from, to string, duration float64, repeat int, s ...string)

AnimateTransform animates in the context of SVG transformations

func (*SVG) AnimateTranslate Uses

func (svg *SVG) AnimateTranslate(link string, fx, fy, tx, ty int, duration float64, repeat int, s ...string)

AnimateTranslate animates the translation transformation

func (*SVG) Arc Uses

func (svg *SVG) Arc(sx int, sy int, ax int, ay int, r int, large bool, sweep bool, ex int, ey int, s ...string)

Arc draws an elliptical arc, with optional style, beginning coordinate at sx,sy, ending coordinate at ex, ey width and height of the arc are specified by ax, ay, the x axis rotation is r if sweep is true, then the arc will be drawn in a "positive-angle" direction (clockwise), if false, the arc is drawn counterclockwise. if large is true, the arc sweep angle is greater than or equal to 180 degrees, otherwise the arc sweep is less than 180 degrees http://www.w3.org/TR/SVG11/paths.html#PathDataEllipticalArcCommands

func (*SVG) Bezier Uses

func (svg *SVG) Bezier(sx int, sy int, cx int, cy int, px int, py int, ex int, ey int, s ...string)

Bezier draws a cubic bezier curve, with optional style, beginning at sx,sy, ending at ex,ey with control points at cx,cy and px,py. Standard Reference: http://www.w3.org/TR/SVG11/paths.html#PathDataCubicBezierCommands

func (*SVG) Blur Uses

func (svg *SVG) Blur(p float64)

Blur emulates the CSS blur filter

func (*SVG) Brightness Uses

func (svg *SVG) Brightness(p float64)

Brightness emulates the CSS brightness filter

func (*SVG) CenterRect Uses

func (svg *SVG) CenterRect(x int, y int, w int, h int, s ...string)

CenterRect draws a rectangle with its center at x,y, with width w, and height h, with optional style

func (*SVG) Circle Uses

func (svg *SVG) Circle(x int, y int, r int, s ...string)

Circle centered at x,y, with radius r, with optional style. Standard Reference: http://www.w3.org/TR/SVG11/shapes.html#CircleElement

func (*SVG) ClipEnd Uses

func (svg *SVG) ClipEnd()

ClipEnd ends a ClipPath

func (*SVG) ClipPath Uses

func (svg *SVG) ClipPath(s ...string)

ClipPath defines a clip path

func (*SVG) Def Uses

func (svg *SVG) Def()

Def begins a defintion block. Standard Reference: http://www.w3.org/TR/SVG11/struct.html#DefsElement

func (*SVG) DefEnd Uses

func (svg *SVG) DefEnd()

DefEnd ends a defintion block.

func (*SVG) Desc Uses

func (svg *SVG) Desc(s string)

Desc specified the text of the description tag. Standard Reference: http://www.w3.org/TR/SVG11/struct.html#DescElement

func (*SVG) Ellipse Uses

func (svg *SVG) Ellipse(x int, y int, w int, h int, s ...string)

Ellipse centered at x,y, centered at x,y with radii w, and h, with optional style. Standard Reference: http://www.w3.org/TR/SVG11/shapes.html#EllipseElement

func (*SVG) End Uses

func (svg *SVG) End()

End the SVG document

func (*SVG) FeBlend Uses

func (svg *SVG) FeBlend(fs Filterspec, mode string, s ...string)

FeBlend specifies a Blend filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feBlendElement

func (*SVG) FeColorMatrix Uses

func (svg *SVG) FeColorMatrix(fs Filterspec, values [20]float64, s ...string)

FeColorMatrix specifies a color matrix filter primitive, with matrix values Standard reference: http://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement

func (*SVG) FeColorMatrixHue Uses

func (svg *SVG) FeColorMatrixHue(fs Filterspec, value float64, s ...string)

FeColorMatrixHue specifies a color matrix filter primitive, with hue rotation values Standard reference: http://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement

func (*SVG) FeColorMatrixLuminence Uses

func (svg *SVG) FeColorMatrixLuminence(fs Filterspec, s ...string)

FeColorMatrixLuminence specifies a color matrix filter primitive, with luminence values Standard reference: http://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement

func (*SVG) FeColorMatrixSaturate Uses

func (svg *SVG) FeColorMatrixSaturate(fs Filterspec, value float64, s ...string)

FeColorMatrixSaturate specifies a color matrix filter primitive, with saturation values Standard reference: http://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement

func (*SVG) FeCompEnd Uses

func (svg *SVG) FeCompEnd()

FeCompEnd ends a feComponent filter element Standard reference: http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement

func (*SVG) FeComponentTransfer Uses

func (svg *SVG) FeComponentTransfer()

FeComponentTransfer begins a feComponent filter element Standard reference: http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement

func (*SVG) FeComposite Uses

func (svg *SVG) FeComposite(fs Filterspec, operator string, k1, k2, k3, k4 int, s ...string)

FeComposite specifies a feComposite filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feCompositeElement

func (*SVG) FeConvolveMatrix Uses

func (svg *SVG) FeConvolveMatrix(fs Filterspec, matrix [9]int, s ...string)

FeConvolveMatrix specifies a feConvolveMatrix filter primitive Standard referencd: http://www.w3.org/TR/SVG11/filters.html#feConvolveMatrixElement

func (*SVG) FeDiffEnd Uses

func (svg *SVG) FeDiffEnd()

FeDiffEnd ends a diffuse lighting filter primitive container Standard reference: http://www.w3.org/TR/SVG11/filters.html#feDiffuseLightingElement

func (*SVG) FeDiffuseLighting Uses

func (svg *SVG) FeDiffuseLighting(fs Filterspec, scale, constant float64, s ...string)

FeDiffuseLighting specifies a diffuse lighting filter primitive, a container for light source elements, end with DiffuseEnd() Standard reference: http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement

func (*SVG) FeDisplacementMap Uses

func (svg *SVG) FeDisplacementMap(fs Filterspec, scale float64, xchannel, ychannel string, s ...string)

FeDisplacementMap specifies a feDisplacementMap filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feDisplacementMapElement

func (*SVG) FeDistantLight Uses

func (svg *SVG) FeDistantLight(fs Filterspec, azimuth, elevation float64, s ...string)

FeDistantLight specifies a feDistantLight filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feDistantLightElement

func (*SVG) FeFlood Uses

func (svg *SVG) FeFlood(fs Filterspec, color string, opacity float64, s ...string)

FeFlood specifies a flood filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feFloodElement

func (*SVG) FeFuncDiscrete Uses

func (svg *SVG) FeFuncDiscrete(channel string, tv []float64)

FeFuncDiscrete specifies the discrete values for the feFunc{R|G|B|A} filter element Standard reference: http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement

func (*SVG) FeFuncGamma Uses

func (svg *SVG) FeFuncGamma(channel string, amplitude, exponent, offset float64)

FeFuncGamma specifies the curve values for gamma correction for the feFunc{R|G|B|A} filter element Standard reference: http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement

func (*SVG) FeFuncLinear Uses

func (svg *SVG) FeFuncLinear(channel string, slope, intercept float64)

FeFuncLinear specifies a linear style function for the feFunc{R|G|B|A} filter element Standard reference: http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement

func (*SVG) FeFuncTable Uses

func (svg *SVG) FeFuncTable(channel string, tv []float64)

FeFuncTable specifies the table of values for the feFunc{R|G|B|A} filter element Standard reference: http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement

func (*SVG) FeGaussianBlur Uses

func (svg *SVG) FeGaussianBlur(fs Filterspec, stdx, stdy float64, s ...string)

FeGaussianBlur specifies a Gaussian Blur filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement

func (*SVG) FeImage Uses

func (svg *SVG) FeImage(href string, result string, s ...string)

FeImage specifies a feImage filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feImageElement

func (*SVG) FeMerge Uses

func (svg *SVG) FeMerge(nodes []string, s ...string)

FeMerge specifies a feMerge filter primitive, containing feMerge elements Standard reference: http://www.w3.org/TR/SVG11/filters.html#feMergeElement

func (*SVG) FeMorphology Uses

func (svg *SVG) FeMorphology(fs Filterspec, operator string, xradius, yradius float64, s ...string)

FeMorphology specifies a feMorphologyLight filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feMorphologyElement

func (*SVG) FeOffset Uses

func (svg *SVG) FeOffset(fs Filterspec, dx, dy int, s ...string)

FeOffset specifies the feOffset filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feOffsetElement

func (*SVG) FePointLight Uses

func (svg *SVG) FePointLight(x, y, z float64, s ...string)

FePointLight specifies a fePpointLight filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#fePointLightElement

func (*SVG) FeSpecEnd Uses

func (svg *SVG) FeSpecEnd()

FeSpecEnd ends a specular lighting filter primitive container Standard reference: http://www.w3.org/TR/SVG11/filters.html#feSpecularLightingElement

func (*SVG) FeSpecularLighting Uses

func (svg *SVG) FeSpecularLighting(fs Filterspec, scale, constant float64, exponent int, color string, s ...string)

FeSpecularLighting specifies a specular lighting filter primitive, a container for light source elements, end with SpecularEnd() Standard reference: http://www.w3.org/TR/SVG11/filters.html#feSpecularLightingElement

func (*SVG) FeSpotLight Uses

func (svg *SVG) FeSpotLight(fs Filterspec, x, y, z, px, py, pz float64, s ...string)

FeSpotLight specifies a feSpotLight filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feSpotLightElement

func (*SVG) FeTile Uses

func (svg *SVG) FeTile(fs Filterspec, in string, s ...string)

FeTile specifies the tile utility filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feTileElement

func (*SVG) FeTurbulence Uses

func (svg *SVG) FeTurbulence(fs Filterspec, ftype string, bfx, bfy float64, octaves int, seed int64, stitch bool, s ...string)

FeTurbulence specifies a turbulence filter primitive Standard reference: http://www.w3.org/TR/SVG11/filters.html#feTurbulenceElement

func (*SVG) Fend Uses

func (svg *SVG) Fend()

Fend ends a filter set Standard reference: http://www.w3.org/TR/SVG11/filters.html#FilterElement

func (*SVG) Filter Uses

func (svg *SVG) Filter(id string, s ...string)

Filter begins a filter set Standard reference: http://www.w3.org/TR/SVG11/filters.html#FilterElement

func (*SVG) Gend Uses

func (svg *SVG) Gend()

Gend ends a group (must be paired with Gsttyle, Gtransform, Gid).

func (*SVG) Gid Uses

func (svg *SVG) Gid(s string)

Gid begins a group, with the specified id

func (*SVG) Grayscale Uses

func (svg *SVG) Grayscale()

Grayscale eumulates the CSS grayscale filter

func (*SVG) Grid Uses

func (svg *SVG) Grid(x int, y int, w int, h int, n int, s ...string)

Grid draws a grid at the specified coordinate, dimensions, and spacing, with optional style.

func (*SVG) Group Uses

func (svg *SVG) Group(s ...string)

Group begins a group with arbitrary attributes

func (*SVG) Gstyle Uses

func (svg *SVG) Gstyle(s string)

Gstyle begins a group, with the specified style. Standard Reference: http://www.w3.org/TR/SVG11/struct.html#GElement

func (*SVG) Gtransform Uses

func (svg *SVG) Gtransform(s string)

Gtransform begins a group, with the specified transform Standard Reference: http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

func (*SVG) HueRotate Uses

func (svg *SVG) HueRotate(a float64)

HueRotate eumulates the CSS huerotate filter

func (*SVG) Image Uses

func (svg *SVG) Image(x int, y int, w int, h int, link string, s ...string)

Image places at x,y (upper left hand corner), the image with width w, and height h, referenced at link, with optional style. Standard Reference: http://www.w3.org/TR/SVG11/struct.html#ImageElement

func (*SVG) Invert Uses

func (svg *SVG) Invert()

Invert eumulates the CSS invert filter

func (*SVG) Line Uses

func (svg *SVG) Line(x1 int, y1 int, x2 int, y2 int, s ...string)

Line draws a straight line between two points, with optional style. Standard Reference: http://www.w3.org/TR/SVG11/shapes.html#LineElement

func (*SVG) LinearGradient Uses

func (svg *SVG) LinearGradient(id string, x1, y1, x2, y2 uint8, sc []Offcolor)

LinearGradient constructs a linear color gradient identified by id, along the vector defined by (x1,y1), and (x2,y2). The stop color sequence defined in sc. Coordinates are expressed as percentages.

func (svg *SVG) Link(href string, title string)

Link begins a link named "name", with the specified title. Standard Reference: http://www.w3.org/TR/SVG11/linking.html#Links

func (*SVG) LinkEnd Uses

func (svg *SVG) LinkEnd()

LinkEnd ends a link.

func (*SVG) Marker Uses

func (svg *SVG) Marker(id string, x, y, width, height int, s ...string)

Marker defines a marker Standard reference: http://www.w3.org/TR/SVG11/painting.html#MarkerElement

func (*SVG) MarkerEnd Uses

func (svg *SVG) MarkerEnd()

MarkerEnd ends a marker

func (*SVG) Mask Uses

func (svg *SVG) Mask(id string, x int, y int, w int, h int, s ...string)

Mask creates a mask with a specified id, dimension, and optional style.

func (*SVG) MaskEnd Uses

func (svg *SVG) MaskEnd()

MaskEnd ends a Mask.

func (*SVG) Path Uses

func (svg *SVG) Path(d string, s ...string)

Path draws an arbitrary path, the caller is responsible for structuring the path data

func (*SVG) Pattern Uses

func (svg *SVG) Pattern(id string, x, y, width, height int, putype string, s ...string)

Pattern defines a pattern with the specified dimensions. The putype can be either "user" or "obj", which sets the patternUnits attribute to be either userSpaceOnUse or objectBoundingBox Standard reference: http://www.w3.org/TR/SVG11/pservers.html#Patterns

func (*SVG) PatternEnd Uses

func (svg *SVG) PatternEnd()

PatternEnd ends a marker

func (*SVG) Polygon Uses

func (svg *SVG) Polygon(x []int, y []int, s ...string)

Polygon draws a series of line segments using an array of x, y coordinates, with optional style. Standard Reference: http://www.w3.org/TR/SVG11/shapes.html#PolygonElement

func (*SVG) Polyline Uses

func (svg *SVG) Polyline(x []int, y []int, s ...string)

Polyline draws connected lines between coordinates, with optional style. Standard Reference: http://www.w3.org/TR/SVG11/shapes.html#PolylineElement

func (*SVG) Qbez Uses

func (svg *SVG) Qbez(sx int, sy int, cx int, cy int, ex int, ey int, s ...string)

Qbez draws a quadratic bezier curver, with optional style beginning at sx,sy, ending at ex, sy with control points at cx, cy Standard Reference: http://www.w3.org/TR/SVG11/paths.html#PathDataQuadraticBezierCommands

func (*SVG) Qbezier Uses

func (svg *SVG) Qbezier(sx int, sy int, cx int, cy int, ex int, ey int, tx int, ty int, s ...string)

Qbezier draws a Quadratic Bezier curve, with optional style, beginning at sx, sy, ending at tx,ty with control points are at cx,cy, ex,ey. Standard Reference: http://www.w3.org/TR/SVG11/paths.html#PathDataQuadraticBezierCommands

func (*SVG) RGB Uses

func (svg *SVG) RGB(r int, g int, b int) string

RGB specifies a fill color in terms of a (r)ed, (g)reen, (b)lue triple. Standard reference: http://www.w3.org/TR/css3-color/

func (*SVG) RGBA Uses

func (svg *SVG) RGBA(r int, g int, b int, a float64) string

RGBA specifies a fill color in terms of a (r)ed, (g)reen, (b)lue triple and opacity.

func (*SVG) RadialGradient Uses

func (svg *SVG) RadialGradient(id string, cx, cy, r, fx, fy uint8, sc []Offcolor)

RadialGradient constructs a radial color gradient identified by id, centered at (cx,cy), with a radius of r. (fx, fy) define the location of the focal point of the light source. The stop color sequence defined in sc. Coordinates are expressed as percentages.

func (*SVG) Rect Uses

func (svg *SVG) Rect(x int, y int, w int, h int, s ...string)

Rect draws a rectangle with upper left-hand corner at x,y, with width w, and height h, with optional style Standard Reference: http://www.w3.org/TR/SVG11/shapes.html#RectElement

func (*SVG) Rotate Uses

func (svg *SVG) Rotate(r float64)

Rotate rotates the coordinate system by r degrees, end with Gend() Standard Reference: http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

func (*SVG) RotateTranslate Uses

func (svg *SVG) RotateTranslate(x, y int, r float64)

RotateTranslate rotates the coordinate system r degrees, then translates to (x,y), end with Gend()

func (*SVG) Roundrect Uses

func (svg *SVG) Roundrect(x int, y int, w int, h int, rx int, ry int, s ...string)

Roundrect draws a rounded rectangle with upper the left-hand corner at x,y, with width w, and height h. The radii for the rounded portion are specified by rx (width), and ry (height). Style is optional. Standard Reference: http://www.w3.org/TR/SVG11/shapes.html#RectElement

func (*SVG) Saturate Uses

func (svg *SVG) Saturate(p float64)

Saturate eumulates the CSS saturate filter

func (*SVG) Scale Uses

func (svg *SVG) Scale(n float64)

Scale scales the coordinate system by n, end with Gend() Standard Reference: http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

func (*SVG) ScaleXY Uses

func (svg *SVG) ScaleXY(dx, dy float64)

ScaleXY scales the coordinate system by dx and dy, end with Gend() Standard Reference: http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

func (*SVG) Script Uses

func (svg *SVG) Script(scriptype string, data ...string)

Script defines a script with a specified type, (for example "application/javascript").

func (*SVG) Sepia Uses

func (svg *SVG) Sepia()

Sepia applies a sepia tone, emulating the CSS sepia filter

func (*SVG) SkewX Uses

func (svg *SVG) SkewX(a float64)

SkewX skews the x coordinate system by angle a, end with Gend() Standard Reference: http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

func (*SVG) SkewXY Uses

func (svg *SVG) SkewXY(ax, ay float64)

SkewXY skews x and y coordinates by ax, ay respectively, end with Gend() Standard Reference: http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

func (*SVG) SkewY Uses

func (svg *SVG) SkewY(a float64)

SkewY skews the y coordinate system by angle a, end with Gend() Standard Reference: http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

func (*SVG) Square Uses

func (svg *SVG) Square(x int, y int, l int, s ...string)

Square draws a square with upper left corner at x,y with sides of length l, with optional style.

func (*SVG) Start Uses

func (svg *SVG) Start(w int, h int, ns ...string)

Start begins the SVG document with the width w and height h. Other attributes may be optionally added, for example viewbox or additional namespaces Standard Reference: http://www.w3.org/TR/SVG11/struct.html#SVGElement

func (*SVG) Startpercent Uses

func (svg *SVG) Startpercent(w int, h int, ns ...string)

Startpercent begins the SVG document, with width and height as percentages Other attributes may be optionally added, for example viewbox or additional namespaces

func (*SVG) Startraw Uses

func (svg *SVG) Startraw(ns ...string)

Startraw begins the SVG document, passing arbitrary attributes

func (*SVG) Startunit Uses

func (svg *SVG) Startunit(w int, h int, unit string, ns ...string)

Startunit begins the SVG document, with width and height in the specified units Other attributes may be optionally added, for example viewbox or additional namespaces

func (*SVG) Startview Uses

func (svg *SVG) Startview(w, h, minx, miny, vw, vh int)

Startview begins the SVG document, with the specified width, height, and viewbox Other attributes may be optionally added, for example viewbox or additional namespaces

func (*SVG) StartviewUnit Uses

func (svg *SVG) StartviewUnit(w, h int, unit string, minx, miny, vw, vh int)

StartviewUnit begins the SVG document with the specified width, height, and unit

func (*SVG) Style Uses

func (svg *SVG) Style(scriptype string, data ...string)

Style defines the specified style (for example "text/css")

func (*SVG) Text Uses

func (svg *SVG) Text(x int, y int, t string, s ...string)

Text places the specified text, t at x,y according to the style specified in s Standard Reference: http://www.w3.org/TR/SVG11/text.html#TextElement

func (*SVG) Textlines Uses

func (svg *SVG) Textlines(x, y int, s []string, size, spacing int, fill, align string)

Textlines places a series of lines of text starting at x,y, at the specified size, fill, and alignment. Each line is spaced according to the spacing argument

func (*SVG) Textpath Uses

func (svg *SVG) Textpath(t string, pathid string, s ...string)

Textpath places text optionally styled text along a previously defined path Standard Reference: http://www.w3.org/TR/SVG11/text.html#TextPathElement

func (*SVG) Title Uses

func (svg *SVG) Title(s string)

Title specified the text of the title tag. Standard Reference: http://www.w3.org/TR/SVG11/struct.html#TitleElement

func (*SVG) Translate Uses

func (svg *SVG) Translate(x, y int)

Translate begins coordinate translation, end with Gend() Standard Reference: http://www.w3.org/TR/SVG11/coords.html#TransformAttribute

func (*SVG) TranslateRotate Uses

func (svg *SVG) TranslateRotate(x, y int, r float64)

TranslateRotate translates the coordinate system to (x,y), then rotates to r degrees, end with Gend()

func (*SVG) Use Uses

func (svg *SVG) Use(x int, y int, link string, s ...string)

Use places the object referenced at link at the location x, y, with optional style. Standard Reference: http://www.w3.org/TR/SVG11/struct.html#UseElement

Directories

PathSynopsis
am
amt
android
animate
barchartbarchart - bar chart
benchvizbenchviz: visualize benchmark data from benchcmp
bubtrail
bulletgraph
codepic
colortab
compx
cubecube: draw cubes
f50
fe
floatPackage svg generates SVG as defined by the Scalable Vector Graphics 1.1 Specification (<http://www.w3.org/TR/SVG11/>).
float/svgdef
flower
fontcompare
funnel
gradient
html5logo
imfade
lewitt
ltr
marker
paths
patternpattern: test the pattern function
personalpersonal: make persona slides
picservpicserv: serve pictures
planets
pmap
randcomp
richter
rl
rpd
rrradar roadmap (via Ernst and Young)
shotchartshotchart: make NBA shotcharts
skewabc
stockproduct
structlayout-svgstructlayout-svg: generate SVG struct layouts
svgdef
svgopher
svgplaysvgplay: sketch with SVGo, (derived from the old misc/goplay), except: (1) only listen on localhost, (default port 1999) (2) always render html, (3) SVGo default code,
svgplot
svgrid
tsg
tumblrgrid
turbulence
vismem
webfonts
websvg

Package svg imports 4 packages (graph) and is imported by 979 packages. Updated 2019-11-24. Refresh now. Tools for package owners.