{"id":13366571,"url":"https://github.com/ajstarks/svGo","last_synced_at":"2025-03-12T18:31:08.656Z","repository":{"id":41894816,"uuid":"549192","full_name":"ajstarks/svgo","owner":"ajstarks","description":"Go Language Library for SVG generation","archived":false,"fork":false,"pushed_at":"2022-12-09T13:57:06.000Z","size":21410,"stargazers_count":2149,"open_issues_count":16,"forks_count":170,"subscribers_count":55,"default_branch":"master","last_synced_at":"2024-10-19T16:55:36.651Z","etag":null,"topics":["go","golang","golang-library","golang-package","graphic-design","graphic-programming","graphics","markup","sketch","svg","svg-images","svg-path","visualization","xml"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajstarks.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-03-05T23:24:10.000Z","updated_at":"2024-10-16T16:09:14.000Z","dependencies_parsed_at":"2023-01-25T14:00:14.725Z","dependency_job_id":null,"html_url":"https://github.com/ajstarks/svgo","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajstarks%2Fsvgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajstarks%2Fsvgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajstarks%2Fsvgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajstarks%2Fsvgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajstarks","download_url":"https://codeload.github.com/ajstarks/svgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221309836,"owners_count":16795821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","golang-library","golang-package","graphic-design","graphic-programming","graphics","markup","sketch","svg","svg-images","svg-path","visualization","xml"],"created_at":"2024-07-30T00:01:27.382Z","updated_at":"2024-10-24T11:30:21.832Z","avatar_url":"https://github.com/ajstarks.png","language":"Go","readme":"# SVGo: A Go library for SVG generation #\n\nThe library generates SVG as defined by the Scalable Vector Graphics 1.1 Specification (\u003chttp://www.w3.org/TR/SVG11/\u003e). \nOutput goes to the specified io.Writer.\n\n## Supported SVG elements and functions ##\n\n### Shapes, lines, text\n \n circle, ellipse, polygon, polyline, rect (including roundrects), line, text\n \n### Paths \n \n general, arc, cubic and quadratic bezier paths, \n \n### Image and Gradients\n \n image, linearGradient, radialGradient, \n \n### Transforms ###\n \n translate, rotate, scale, skewX, skewY\n\n ### Animation ###\n animate, animateMotion, animateTranslate, animateRotate, animateScale, animateSkewX, animateSkewY\n \n### Filter Effects \n \n filter, feBlend, feColorMatrix, feColorMatrix, feComponentTransfer, feComposite, feConvolveMatrix, feDiffuseLighting,\n feDisplacementMap, feDistantLight, feFlood, feGaussianBlur, feImage, feMerge, feMorphology, feOffset, fePointLight,\n feSpecularLighting, feSpotLight,feTile, feTurbulence\n\n\n### Metadata elements ###\n\n desc, defs, g (style, transform, id), marker, mask, pattern, title, (a)ddress, link, script, use\n\n## Building and Usage ##\n\nSee svgdef.[svg|png|pdf] for a graphical view of the function calls\n\n\nUsage: (assuming GOPATH is set)\n\n\tgo get github.com/ajstarks/svgo\n\tgo install github.com/ajstarks/svgo/...\n\t\n\t\nYou can use godoc to browse the documentation from the command line:\n\n\t$ go doc github.com/ajstarks/svgo\n\t\n\na minimal program, to generate SVG to standard output.\n\n\tpackage main\n\t\n\timport (\n\t\t\"github.com/ajstarks/svgo\"\n\t\t\"os\"\n\t)\n\t\n\tfunc main() {\n\t\twidth := 500\n\t\theight := 500\n\t\tcanvas := svg.New(os.Stdout)\n\t\tcanvas.Start(width, height)\n\t\tcanvas.Circle(width/2, height/2, 100)\n\t\tcanvas.Text(width/2, height/2, \"Hello, SVG\", \"text-anchor:middle;font-size:30px;fill:white\")\n\t\tcanvas.End()\n\t}\n\nDrawing in a web server: (http://localhost:2003/circle)\n\n\tpackage main\n\t\n\timport (\n\t\t\"log\"\n\t\t\"github.com/ajstarks/svgo\"\n\t\t\"net/http\"\n\t)\n\t\n\tfunc main() {\n\t\thttp.Handle(\"/circle\", http.HandlerFunc(circle))\n\t\terr := http.ListenAndServe(\":2003\", nil)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"ListenAndServe:\", err)\n\t\t}\n\t}\n\t\n\tfunc circle(w http.ResponseWriter, req *http.Request) {\n\t  w.Header().Set(\"Content-Type\", \"image/svg+xml\")\n\t  s := svg.New(w)\n\t  s.Start(500, 500)\n\t  s.Circle(250, 250, 125, \"fill:none;stroke:black\")\n\t  s.End()\n\t}\n\nYou may view the SVG output with a browser that supports SVG (tested on Chrome, Opera, Firefox and Safari), or any other SVG user-agent such as Batik Squiggle.\n\n### Graphics Sketching with SVGo and svgplay ###\n\nCombined with the svgplay command, SVGo can be used to \"sketch\" with code in a browser.  \n\nTo use svgplay and SVGo, first go to a directory with your code, and run:\n\n\t$ svgplay\n\t2014/06/25 22:05:28 ☠ ☠ ☠ Warning: this server allows a client connecting to 127.0.0.1:1999 to execute code on this computer ☠ ☠ ☠\t\n\t\nNext open your browser to the svgplay server you just started.\nsvgplay only listens on localhost, and uses port 1999 (guess which year SVG was first introduced) by default\n\n\thttp://localhost:1999/\n\nEnter your code in the textarea, and when you are ready to run press Shift--Enter.  The code will be compiled, with the results\non the right.  To update, change the code and repeat. Note that compilation errors are shown in red under the code. In order for svgplay/SVGo to work, make sure that the io.Writer specified with the New function is os.Stdout.\n\n\nIf you want to sketch with an existing file, enter its URL:\n\n\thttp://localhost:1999/foo.go\n\t\n![SVGplay](https://farm4.staticflickr.com/3859/14322978157_31c0114850.jpg)\n\n\n### SVGo Papers and presentations  ###\n\n* SVGo paper from SVGOpen 2011 \u003chttp://www.svgopen.org/2011/papers/34-SVGo_a_Go_Library_for_SVG_generation\u003e\n\n* Programming Pictures with SVGo \u003chttps://speakerdeck.com/u/ajstarks/p/programming-pictures-with-svgo\u003e\n\n* SVGo Workshop \u003chttps://speakerdeck.com/u/ajstarks/p/svgo-workshop\u003e\n\n\n### Tutorial Video ###\n\nA video describing how to use the package can be seen on YouTube at \u003chttp://www.youtube.com/watch?v=ze6O2Dj5gQ4\u003e\n\n## Package contents ##\n\n* svg.go:\t\tLibrary\n* newsvg:\t\tCoding template command\n* svgdef:\tCreates a SVG representation of the API\n* animate:  Animation demo\n* am: Animate motion demo\n* amt: Animate transformation demo\n* android:\tThe Android logo\n* bubtrail: Bubble trails\n* bulletgraph:\tBullet Graphs (via Stephen Few)\n* colortab: Display SVG named colors with RGB values\n* compx:  Component diagrams\n* flower:\tRandom \"flowers\"\n* fontcompare:\tCompare two fonts\n* f50:\t\tGet 50 photos from Flickr based on a query\n* fe:\tFilter effects\n* funnel:\tFunnel from transparent circles\n* gradient:\tLinear and radial gradients\n* html5logo:\tHTML5 logo with draggable elements\n* imfade:\tShow image fading\n* lewitt:\tVersion of Sol Lewitt's Wall Drawing 91\n* ltr:\t\tLayer Tennis Remixes\n* marker: Test markers\n* paths:\t\tDemonstrate SVG paths\n* pattern:\tTest patterns\n* planets:\tShow the scale of the Solar system\n* pmap:\t\tProportion maps\n* randcomp:\tCompare random number generators\n* richter:\tGerhard Richter's 256 colors\n* rl:\t\t\tRandom lines (port of a Processing demo)\n* skewabc:\t\tSkew ABC\n* span:\t\tText span\n* stockproduct:\tVisualize product and stock prices\n* svgopher:\tSVGo Mascot\n* svgplay: SVGo sketching server\n* svgplot:\t\tPlot data\n* svgrid:\tCompose SVG files in a grid\n* tsg:  Twitter Search Grid\n* tumblrgrid:\tTumblr picture grid\n* turbulence:\tTurbulence filter effect\n* vismem:\tVisualize data from files\n* webfonts:\t\"Hello, World\" with Google Web Fonts\n* websvg:\tGenerate SVG as a web server\n\n\n## Functions and types ##\n\nMany functions use x, y to specify an object's location, and w, h to specify the object's width and height.\nWhere applicable, a final optional argument specifies the style to be applied to the object. \nThe style strings follow the SVG standard; name:value pairs delimited by semicolons, or a\nseries of name=\"value\" pairs. For example: `\"fill:none; opacity:0.3\"` or  `fill=\"none\" opacity=\"0.3\"` (see: \u003chttp://www.w3.org/TR/SVG11/styling.html\u003e)\n\nThe SVG type:\n\n\ttype SVG struct {\n        Writer   io.Writer\n\t}\n\nMost operations are methods on this type, specifying the destination io.Writer.\n\nThe Offcolor type:\n\n\ttype Offcolor struct {\n\t\tOffset  uint8\n\t\tColor   string\n\t\tOpacity float64\n\t}\n\nis used to specify the offset, color, and opacity of stop colors in linear and radial gradients\n\nThe Filterspec type:\n\n\ttype Filterspec struct {\n\t\tIn string\n\t\tIn2 string\n\t\tResult string\n\t}\n\t\nis used to specify inputs and results for filter effects\n\n\n### Structure, Scripting, Metadata, Transformation and Links ###\n\n\tNew(w io.Writer) *SVG\n  Constructor, Specify the output destination.\n  \n\tStart(w int, h int, attributes ...string)\n  begin the SVG document with the width w and height h. Optionally add additional elements\n  (such as additional namespaces or scripting events)\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#SVGElement\u003e\n  \n\tStartview(w, h, minx, miny, vw, vh int)\n  begin the SVG document with the width w, height h, with a viewBox at minx, miny, vw, vh.\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#SVGElement\u003e\n  \n\tStartunit(w int, h int, unit string, ns ...string)\n  begin the SVG document, with width and height in the specified units. Optionally add additional elements\n  (such as additional namespaces or scripting events)\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#SVGElement\u003e\n\n  \n\tStartpercent(w int, h int, ns ...string)\n  begin the SVG document, with width and height in percent. Optionally add additional elements\n  (such as additional namespaces or scripting events)\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#SVGElement\u003e\n\n  \n\tStartviewUnit(w, h int, unit string, minx, miny, vw, vh int)\n   begin the SVG document with the width w, height h, in the specified unit, with a viewBox at minx, miny, vw, vh.\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#SVGElement\u003e\n\n\tEnd()\n  end the SVG document\n  \n\tScript(scriptype string, data ...string)\n Script defines a script with a specified type, (for example \"application/javascript\").\n if the first variadic argument is a link, use only the link reference.\n Otherwise, treat variadic arguments as the text of the script (marked up as CDATA).\n if no data is specified, simply close the script element.\n  \u003chttp://www.w3.org/TR/SVG/script.html\u003e\n  \n  \tStyle(scriptype string, data ...string)\n Style defines a script with a specified type, (for example \"text/css\").\n if the first variadic argument is a link, use only the link reference.\n Otherwise, treat variadic arguments as the text of the script (marked up as CDATA).\n if no data is specified, simply close the style element.\n  \u003chttps://www.w3.org/TR/SVG/styling.html#StyleElement\u003e\n  \n\tGroup(s ...string)\n  begin a group, with arbitrary attributes\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#GElement\u003e\n\n\tGstyle(s string)\n  begin a group, with the specified style.\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#GElement\u003e\n\n\tGid(s string)\n   begin a group, with the specified id.\n\n\tGtransform(s string)\n  begin a group, with the specified transform, end with Gend().\n  \u003chttp://www.w3.org/TR/SVG11/coords.html#TransformAttribute\u003e\n\n\tTranslate(x, y int)\n  begins coordinate translation to (x,y), end with Gend().\n  \u003chttp://www.w3.org/TR/SVG11/coords.html#TransformAttribute\u003e\n\n\tScale(n float64)\n  scales the coordinate system by n, end with Gend().\n  \u003chttp://www.w3.org/TR/SVG11/coords.html#TransformAttribute\u003e\n  \n\tScaleXY(x, y float64)\n   scales the coordinate system by x, y. End with Gend().\n   \u003chttp://www.w3.org/TR/SVG11/coords.html#TransformAttribute\u003e\n   \n\tSkewX(a float64)\n   SkewX skews the x coordinate system by angle a, end with Gend().\n   \u003chttp://www.w3.org/TR/SVG11/coords.html#TransformAttribute\u003e\n   \n\tSkewY(a float64)\n   SkewY skews the y coordinate system by angle a, end with Gend().\n   \u003chttp://www.w3.org/TR/SVG11/coords.html#TransformAttribute\u003e\n   \n\tSkewXY(ax, ay float64)\n   SkewXY skews x and y coordinate systems by ax, ay respectively, end with Gend().\n   \u003chttp://www.w3.org/TR/SVG11/coords.html#TransformAttribute\u003e\n\n\tRotate(r float64)\n  rotates the coordinate system by r degrees, end with Gend().\n  \u003chttp://www.w3.org/TR/SVG11/coords.html#TransformAttribute\u003e\n\n\tTranslateRotate(x, y int, r float64)\n   translates the coordinate system to (x,y), then rotates to r degrees, end with Gend().\n\t\n\tRotateTranslate(x, y int, r float64)\n   rotates the coordinate system r degrees, then translates to (x,y), end with Gend().\n\n\tGend()\n   end the group (must be paired with Gstyle, Gtransform, Gid).\n\n\tClipPath(s ...string)\n  Begin a ClipPath\n  \u003chttp://www.w3.org/TR/SVG/masking.html#ClippingPaths\u003e\n\n\tClipEnd()\n  End a ClipPath\n  \u003chttp://www.w3.org/TR/SVG/masking.html#ClippingPaths\u003e\n\n\tDef()\n  begin a definition block.\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#DefsElement\u003e\n\n\tDefEnd()\n  end a definition block.\n\n\tMarker(id string, x, y, w, h int, s ...string)\n  define a marker\n  \u003chttp://www.w3.org/TR/SVG11/painting.html#MarkerElement\u003e\n\n\n\tMarkerEnd()\n  end a marker\n  \n  \n\tMask(id string, x int, y int, w int, h int, s ...string)\n  creates a mask with a specified id, dimension, and optional style.\n  \u003chttp://www.w3.org/TR/SVG/masking.html\u003e\n  \n\tMaskEnd()\n  ends the Mask element.\n\n\n\tPattern(id string, x, y, width, height int, putype string, s ...string)\n define a Pattern with the specified dimensions, the putype can be either \"user\" or \"obj\", which sets the patternUnits\n attribute to be either userSpaceOnUse or objectBoundingBox.\n \u003chttp://www.w3.org/TR/SVG11/pservers.html#Patterns\u003e\n\n\tDesc(s string)\n  specify the text of the description.\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#DescElement\u003e\n\n\tTitle(s string)\n  specify the text of the title.\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#TitleElement\u003e\n\n\tLink(href string, title string)\n  begin a link named \"href\", with the specified title.\n  \u003chttp://www.w3.org/TR/SVG11/linking.html#Links\u003e\n\n\tLinkEnd()\n  end the link.\n\n\tUse(x int, y int, link string, s ...string)\n  place the object referenced at link at the location x, y.\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#UseElement\u003e\n\n### Shapes ###\n\n\tCircle(x int, y int, r int, s ...string)\n  draw a circle, centered at x,y with radius r.\n  \u003chttp://www.w3.org/TR/SVG11/shapes.html#CircleElement\u003e\n  \n  ![Circle](http://farm5.static.flickr.com/4144/5187953823_01a1741489_m.jpg)\n  \n\tEllipse(x int, y int, w int, h int, s ...string)\n  draw an ellipse, centered at x,y with radii w, and h.\n  \u003chttp://www.w3.org/TR/SVG11/shapes.html#EllipseElement\u003e\n  \n  ![Ellipse](http://farm2.static.flickr.com/1271/5187953773_a9d1fc406c_m.jpg)\n \n\tPolygon(x []int, y []int, s ...string)\n  draw a series of line segments using an array of x, y coordinates.\n  \u003chttp://www.w3.org/TR/SVG11/shapes.html#PolygonElement\u003e\n  \n  ![Polygon](http://farm2.static.flickr.com/1006/5187953873_337dc26597_m.jpg)\n \n\tRect(x int, y int, w int, h int, s ...string)\n  draw a rectangle with upper left-hand corner at x,y, with width w, and height h.\n  \u003chttp://www.w3.org/TR/SVG11/shapes.html#RectElement\u003e\n  \n  ![Rect](http://farm2.static.flickr.com/1233/5188556032_86c90e354b_m.jpg)\n  \n\tCenterRect(x int, y int, w int, h int, s ...string)\n draw a rectangle with its center at x,y, with width w, and height h.\n\n\tRoundrect(x int, y int, w int, h int, rx int, ry int, s ...string)\n  draw a rounded rectangle with upper the left-hand corner at x,y, \n  with width w, and height h. The radii for the rounded portion \n  is specified by rx (width), and ry (height).\n  \n  ![Roundrect](http://farm2.static.flickr.com/1275/5188556120_e2a9998fee_m.jpg)\n  \n\tSquare(x int, y int, s int, style ...string)\n  draw a square with upper left corner at x,y with sides of length s.\n  \n  ![Square](http://farm5.static.flickr.com/4110/5187953659_54dcce242e_m.jpg)\n\n### Paths ###\n\n\tPath(p string, s ...style)\n draw the arbitrary path as specified in p, according to the style specified in s. \u003chttp://www.w3.org/TR/SVG11/paths.html\u003e\n\n \n\tArc(sx int, sy int, ax int, ay int, r int, large bool, sweep bool, ex int, ey int, s ...string)\n  draw an elliptical arc beginning coordinate at sx,sy, ending coordinate at ex, ey\n  width and height of the arc are specified by ax, ay, the x axis rotation is r\n  \n  if sweep is true, then the arc will be drawn in a \"positive-angle\" direction (clockwise), \n  if false, the arc is drawn counterclockwise.\n  \n  if large is true, the arc sweep angle is greater than or equal to 180 degrees, \n  otherwise the arc sweep is less than 180 degrees.\n  \u003chttp://www.w3.org/TR/SVG11/paths.html#PathDataEllipticalArcCommands\u003e\n  \n   ![Arc](http://farm2.static.flickr.com/1300/5188556148_df1a176074_m.jpg)\n\n\n \n\tBezier(sx int, sy int, cx int, cy int, px int, py int, ex int, ey int, s ...string)\n  draw a cubic bezier curve, beginning at sx,sy, ending at ex,ey\n  with control points at cx,cy and px,py.\n  \u003chttp://www.w3.org/TR/SVG11/paths.html#PathDataCubicBezierCommands\u003e\n  \n  ![Bezier](http://farm2.static.flickr.com/1233/5188556246_a03e67d013.jpg)\n\n\n \n\tQbezier(sx int, sy int, cx int, cy int, ex int, ey int, tx int, ty int, s ...string)\n  draw a quadratic bezier curve, beginning at sx, sy, ending at tx,ty\n  with control points are at cx,cy, ex,ey.\n  \u003chttp://www.w3.org/TR/SVG11/paths.html#PathDataQuadraticBezierCommands\u003e\n  \n   ![Qbezier](http://farm2.static.flickr.com/1018/5187953917_9a43cf64fb.jpg)\n  \n \n\tQbez(sx int, sy int, cx int, cy int, ex int, ey int, s...string)\n   draws a quadratic bezier curver, with optional style beginning at sx,sy, ending at ex, sy\n   with the control point at cx, cy.\n   \u003chttp://www.w3.org/TR/SVG11/paths.html#PathDataQuadraticBezierCommands\u003e\n   \n   ![Qbez](http://farm6.static.flickr.com/5176/5569879349_5f726aab5e.jpg)\n\n### Lines ###\n\n\tLine(x1 int, y1 int, x2 int, y2 int, s ...string)\n  draw a line segment between x1,y1 and x2,y2.\n  \u003chttp://www.w3.org/TR/SVG11/shapes.html#LineElement\u003e\n \n ![Line](http://farm5.static.flickr.com/4154/5188556080_0be19da0bc.jpg)\n\n \n\tPolyline(x []int, y []int, s ...string)\n  draw a polygon using coordinates specified in x,y arrays.\n  \u003chttp://www.w3.org/TR/SVG11/shapes.html#PolylineElement\u003e\n \n ![Polyline](http://farm2.static.flickr.com/1266/5188556384_a863273a69.jpg)\n\n### Image and Text ###\n\n\tImage(x int, y int, w int, h int, link string, s ...string)\n  place at x,y (upper left hand corner), the image with width w, and height h, referenced at link.\n  \u003chttp://www.w3.org/TR/SVG11/struct.html#ImageElement\u003e\n \n ![Image](http://farm5.static.flickr.com/4058/5188556346_e5ce3dcbc2_m.jpg)\n\n\tText(x int, y int, t string, s ...string)\n  Place the specified text, t at x,y according to the optional style specified in s.\n  \u003chttp://www.w3.org/TR/SVG11/text.html#TextElement\u003e\n\n\tTextspan(x int, y int, t string, s ...string)\nPlace specified text, t at x,y according to the optional style specified in s.\n\u003chttps://www.w3.org/TR/SVG11/text.html#TSpanElement\u003e\nUse this method with Span(...). End with TextEnd()\n\n\tSpan(t string, s ...string)\nCreate a text span t, using optional style s\n\n\tTextEnd()\nEnd a text span\n  \n\tTextlines(x, y int, s []string, size, spacing int, fill, align string)\n Places lines of text in s, starting at x,y, at the specified size, fill, and alignment, and spacing.\n    \n\tTextpath(t string, pathid string, s ...string)\n  places optionally styled text along a previously defined path.\n  \u003chttp://www.w3.org/TR/SVG11/text.html#TextPathElement\u003e\n  ![Image](http://farm4.static.flickr.com/3149/5694580737_4b291df768_m.jpg)\n  \n### Color ###\n\n\tRGB(r int, g int, b int) string\n  creates a style string for the fill color designated \n  by the (r)ed, g(reen), (b)lue components.\n  \u003chttp://www.w3.org/TR/css3-color/\u003e\n  \n\tRGBA(r int, g int, b int, a float64) string\n  as above, but includes the color's opacity as a value\n  between 0.0 (fully transparent) and 1.0 (opaque).\n  \n### Gradients ###\n\n\tLinearGradient(id string, x1, y1, x2, y2 uint8, sc []Offcolor)\n  constructs a linear color gradient identified by id, \n  along the vector defined by (x1,y1), and (x2,y2).\n  The stop color sequence defined in sc. Coordinates are expressed as percentages.\n  \u003chttp://www.w3.org/TR/SVG11/pservers.html#LinearGradients\u003e\n  ![LinearGradient](http://farm5.static.flickr.com/4153/5187954033_3972f63fa9.jpg) \n  \n\tRadialGradient(id string, cx, cy, r, fx, fy uint8, sc []Offcolor)\n  constructs a radial color gradient identified by id, \n  centered at (cx,cy), with a radius of r.\n  (fx, fy) define the location of the focal point of the light source. \n  The stop color sequence defined in sc.\n  Coordinates are expressed as percentages.\n  \u003chttp://www.w3.org/TR/SVG11/pservers.html#RadialGradients\u003e\n  \n  ![RadialGradient](http://farm2.static.flickr.com/1302/5187954065_7ddba7b819.jpg)\n\n### Animation ###\n\n\tAnimate(link, attr string, from, to int, duration float64, repeat int, s ...string)\nAnimate animates the item referenced by the link, using the specified attribute\nThe animation starts at coordinate from, terminates at to, and repeats as specified.\nAddtional attributes may be added as needed.\n\u003chttps://www.w3.org/TR/SVG11/animate.html#AnimateElement\u003e\n\n\tAnimateMotion(link, path string, duration float64, repeat int, s ...string) \nAnimateMotion animates the referenced object ```link``` along the specified ```path```\n\u003chttps://www.w3.org/TR/SVG11/animate.html#AnimateMotionElement\u003e\n\n\t\n\tAnimateTranslate(link string, fx, fy, tx, ty int, duration float64, repeat int, s ...string)\nAnimateTranslate animates the translation transformation (link refers to the object to animate, fx, fy are from coordinates, tx, ty are the to coordinates)\n\u003chttps://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement\u003e\n\t\n\tAnimateRotate(link string, fs, fc, fe, ts, tc, te int, duration float64, repeat int, s ...string)\nAnimateRotate animates the rotation transformation (link refers to the object to animate, f[s,c,e] are the from start, center, and end angles, t[s,c,e] are the \nstart, center, and end angles)\n\u003chttps://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement\u003e\n\n\t\n\tAnimateScale(link string, from, to, duration float64, repeat int, s ...string)\nAnimateScale animates the scale transformation (link refers to the object to animate, from and to specify the scaling factor)\n\u003chttps://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement\u003e\n\n\t\n\tAnimateSkewX(link string, from, to, duration float64, repeat int, s ...string)\nAnimateSkewX animates the skewX transformation ((link refers to the object to animate, from and to specify the skew angle)\n\u003chttps://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement\u003e\n\n\t\n\tAnimateSkewY(link string, from, to, duration float64, repeat int, s ...string)\nAnimateSkewY animates the skewY transformation (link refers to the object to animate, and from and to specify the skew angle)\n\u003chttps://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement\u003e\n\n  \n### Filter Effects ###\n\n\tFilter(id string, s ...string)\n Filter begins a filter set\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#FilterElement\u003e\n\n \tFend() \nFend ends a filter set\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#FilterElement\u003e\n\n \tFeBlend(fs Filterspec, mode string, s ...string) \nFeBlend specifies a Blend filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feBlendElement\u003e\n\n \tFeColorMatrix(fs Filterspec, values [20]float64, s ...string)\t\nFeColorMatrix specifies a color matrix filter primitive, with matrix values\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement\u003e\n\n \tFeColorMatrixHue(fs Filterspec, value float64, s ...string)  \t\nFeColorMatrix specifies a color matrix filter primitive, with hue values\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement\u003e\n\n \tFeColorMatrixSaturate(fs Filterspec, value float64, s ...string) \nFeColorMatrix specifies a color matrix filter primitive, with saturation values\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement\u003e\n\n \tFeColorMatrixLuminence(fs Filterspec, s ...string) \nFeColorMatrix specifies a color matrix filter primitive, with luminence values\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement\u003e \t\n \t\n \tFeComponentTransfer()  \t\nFeComponentTransfer begins a feComponent filter Element\u003e\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement\u003e\n\n \tFeCompEnd()\nFeCompEnd ends a feComponent filter Element\u003e\n \n \tFeComposite(fs Filterspec, operator string, k1, k2, k3, k4 int, s ...string)\nFeComposite specifies a feComposite filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feCompositeElement\u003e\n\n \tFeConvolveMatrix(fs Filterspec, matrix [9]int, s ...string)\nFeConvolveMatrix specifies a feConvolveMatrix filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feConvolveMatrixElement\u003e\n\n\n\t FeDiffuseLighting(fs Filterspec, scale, constant float64, s ...string) \nFeDiffuseLighting specifies a diffuse lighting filter primitive, \na container for light source Element\u003es, end with DiffuseEnd()\n\n\t FeDiffEnd()\nFeDiffuseEnd ends a diffuse lighting filter primitive container\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feDiffuseLightingElement\u003e\n\n\n\t FeDisplacementMap(fs Filterspec, scale float64, xchannel, ychannel string, s ...string)\nFeDisplacementMap specifies a feDisplacementMap filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feDisplacementMapElement\u003e\n\n\t FeDistantLight(fs Filterspec, azimuth, elevation float64, s ...string)\nFeDistantLight specifies a feDistantLight filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feDistantLightElement\u003e\n\n\t FeFlood(fs Filterspec, color string, opacity float64, s ...string)\nFeFlood specifies a flood filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feFloodElement\u003e\n\n\tFeFuncLinear(channel string, slope, intercept float64)\nFeFuncLinear is the linear form of feFunc\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement\u003e\n\n\t FeFuncGamma(channel, amplitude, exponent, offset float64)\nFeFuncGamma is the gamma curve form of feFunc\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement\u003e\n\n\tFeFuncTable(channel string, tv []float64)\nFeFuncGamma is the form of feFunc using a table of values\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement\u003e\n\t\n\tFeFuncDiscrete(channel string, tv []float64)\nFeFuncGamma is the form of feFunc using discrete values\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement\u003e\n\n\t FeGaussianBlur(fs Filterspec, stdx, stdy float64, s ...string)\nFeGaussianBlur specifies a Gaussian Blur filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement\u003e\n\n\t FeImage(href string, result string, s ...string)\nFeImage specifies a feImage filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feImageElement\u003e\n\n\t FeMerge(nodes []string, s ...string)\nFeMerge specifies a feMerge filter primitive, containing feMerge Element\u003es\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feMergeElement\u003e\n\n\t FeMorphology(fs Filterspec, operator string, xradius, yradius float64, s ...string)\nFeMorphologyLight specifies a feMorphologyLight filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feMorphologyElement\u003e\n\n\t FeOffset(fs Filterspec, dx, dy int, s ...string)\nFeOffset specifies the feOffset filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feOffsetElement\u003e\n\n\t FePointLight(x, y, z float64, s ...string)\nFePointLight specifies a fePpointLight filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#fePointLightElement\u003e\n\n\t FeSpecularLighting(fs Filterspec, scale, constant float64, exponent int, color string, s ...string)\nFeSpecularLighting specifies a specular lighting filter primitive, \na container for light source elements, end with SpecularEnd()\n\n\n\t FeSpecEnd()\nFeSpecularEnd ends a specular lighting filter primitive container\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feSpecularLightingElement\u003e\n\n\n\t FeSpotLight(fs Filterspec, x, y, z, px, py, pz float64, s ...string)\nFeSpotLight specifies a feSpotLight filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feSpotLightElement\u003e\n\n\t FeTile(fs Filterspec, in string, s ...string)\nFeTile specifies the tile utility filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feTileElement\u003e\n\n\n\t FeTurbulence(fs Filterspec, ftype string, bfx, bfy float64, octaves int, seed int64, stitch bool, s ...string)\nFeTurbulence specifies a turbulence filter primitive\nStandard reference: \u003chttp://www.w3.org/TR/SVG11/filters.html#feTurbulenceElement\u003e\n\n### Filter convenience functions (modeled on CSS filter effects) ###\n\n\tBlur(p float64)\nBlur function by standard deviation\n\n\tBrightness(p float64)\nBrightness function (0-100)\n\n\tGrayscale()\nApply a grayscale filter to the image\t\n\t\n\tHueRotate(a float64)\nRotate Hues (0-360 degrees)\n\t\n\tInvert()\nInvert the image's colors\n\t\n\tSaturate(p float64)\nPercent saturation, 0 is grayscale\n\n\tSepia()\nApply sepia tone\n\n\n### Utility ###\n\n\tGrid(x int, y int, w int, h int, n int, s ...string)\n  draws a grid of straight lines starting at x,y, with a width w, and height h, and a size of n.\n  \n  ![Grid](http://farm5.static.flickr.com/4133/5190957924_7a31d0db34.jpg)\n  \n### Credits ###\n\nThanks to Jonathan Wright for the io.Writer update.\n","funding_links":[],"categories":["圖象","图像"],"sub_categories":["高級控制台界面","高级控制台界面"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajstarks%2FsvGo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajstarks%2FsvGo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajstarks%2FsvGo/lists"}