Initial commit from fork
This commit is contained in:
220
vendor/github.com/ajstarks/svgo/LICENSE
generated
vendored
Normal file
220
vendor/github.com/ajstarks/svgo/LICENSE
generated
vendored
Normal file
@ -0,0 +1,220 @@
|
||||
Creative Commons Attribution 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree to
|
||||
be bound by the terms and conditions of this Creative Commons Attribution
|
||||
4.0 International Public License ("Public License"). To the extent this
|
||||
Public License may be interpreted as a contract, You are granted the
|
||||
Licensed Rights in consideration of Your acceptance of these terms and
|
||||
conditions, and the Licensor grants You such rights in consideration
|
||||
of benefits the Licensor receives from making the Licensed Material
|
||||
available under these terms and conditions.
|
||||
|
||||
Section 1 – Definitions.
|
||||
|
||||
Adapted Material means material subject to Copyright and Similar Rights
|
||||
that is derived from or based upon the Licensed Material and in which
|
||||
the Licensed Material is translated, altered, arranged, transformed, or
|
||||
otherwise modified in a manner requiring permission under the Copyright
|
||||
and Similar Rights held by the Licensor. For purposes of this Public
|
||||
License, where the Licensed Material is a musical work, performance,
|
||||
or sound recording, Adapted Material is always produced where the
|
||||
Licensed Material is synched in timed relation with a moving image.
|
||||
Adapter's License means the license You apply to Your Copyright and
|
||||
Similar Rights in Your contributions to Adapted Material in accordance
|
||||
with the terms and conditions of this Public License. Copyright and
|
||||
Similar Rights means copyright and/or similar rights closely related to
|
||||
copyright including, without limitation, performance, broadcast, sound
|
||||
recording, and Sui Generis Database Rights, without regard to how the
|
||||
rights are labeled or categorized. For purposes of this Public License,
|
||||
the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights. Effective Technological Measures means those measures that,
|
||||
in the absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright Treaty
|
||||
adopted on December 20, 1996, and/or similar international agreements.
|
||||
Exceptions and Limitations means fair use, fair dealing, and/or any other
|
||||
exception or limitation to Copyright and Similar Rights that applies to
|
||||
Your use of the Licensed Material. Licensed Material means the artistic
|
||||
or literary work, database, or other material to which the Licensor
|
||||
applied this Public License. Licensed Rights means the rights granted
|
||||
to You subject to the terms and conditions of this Public License, which
|
||||
are limited to all Copyright and Similar Rights that apply to Your use
|
||||
of the Licensed Material and that the Licensor has authority to license.
|
||||
Licensor means the individual(s) or entity(ies) granting rights under
|
||||
this Public License. Share means to provide material to the public by
|
||||
any means or process that requires permission under the Licensed Rights,
|
||||
such as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
available to the public including in ways that members of the public
|
||||
may access the material from a place and at a time individually chosen
|
||||
by them. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of the
|
||||
Council of 11 March 1996 on the legal protection of databases, as amended
|
||||
and/or succeeded, as well as other essentially equivalent rights anywhere
|
||||
in the world. You means the individual or entity exercising the Licensed
|
||||
Rights under this Public License. Your has a corresponding meaning.
|
||||
Section 2 – Scope.
|
||||
|
||||
License grant. Subject to the terms and conditions of this Public
|
||||
License, the Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to exercise the
|
||||
Licensed Rights in the Licensed Material to: reproduce and Share the
|
||||
Licensed Material, in whole or in part; and produce, reproduce, and
|
||||
Share Adapted Material. Exceptions and Limitations. For the avoidance
|
||||
of doubt, where Exceptions and Limitations apply to Your use, this
|
||||
Public License does not apply, and You do not need to comply with
|
||||
its terms and conditions. Term. The term of this Public License is
|
||||
specified in Section 6(a). Media and formats; technical modifications
|
||||
allowed. The Licensor authorizes You to exercise the Licensed Rights in
|
||||
all media and formats whether now known or hereafter created, and to make
|
||||
technical modifications necessary to do so. The Licensor waives and/or
|
||||
agrees not to assert any right or authority to forbid You from making
|
||||
technical modifications necessary to exercise the Licensed Rights,
|
||||
including technical modifications necessary to circumvent Effective
|
||||
Technological Measures. For purposes of this Public License, simply making
|
||||
modifications authorized by this Section 2(a)(4) never produces Adapted
|
||||
Material. Downstream recipients. Offer from the Licensor – Licensed
|
||||
Material. Every recipient of the Licensed Material automatically receives
|
||||
an offer from the Licensor to exercise the Licensed Rights under the terms
|
||||
and conditions of this Public License. No downstream restrictions. You
|
||||
may not offer or impose any additional or different terms or conditions
|
||||
on, or apply any Effective Technological Measures to, the Licensed
|
||||
Material if doing so restricts exercise of the Licensed Rights by any
|
||||
recipient of the Licensed Material. No endorsement. Nothing in this
|
||||
Public License constitutes or may be construed as permission to assert
|
||||
or imply that You are, or that Your use of the Licensed Material is,
|
||||
connected with, or sponsored, endorsed, or granted official status by,
|
||||
the Licensor or others designated to receive attribution as provided in
|
||||
Section 3(a)(1)(A)(i). Other rights.
|
||||
|
||||
Moral rights, such as the right of integrity, are not licensed under
|
||||
this Public License, nor are publicity, privacy, and/or other similar
|
||||
personality rights; however, to the extent possible, the Licensor waives
|
||||
and/or agrees not to assert any such rights held by the Licensor to the
|
||||
limited extent necessary to allow You to exercise the Licensed Rights, but
|
||||
not otherwise. Patent and trademark rights are not licensed under this
|
||||
Public License. To the extent possible, the Licensor waives any right
|
||||
to collect royalties from You for the exercise of the Licensed Rights,
|
||||
whether directly or through a collecting society under any voluntary or
|
||||
waivable statutory or compulsory licensing scheme. In all other cases
|
||||
the Licensor expressly reserves any right to collect such royalties.
|
||||
Section 3 – License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
|
||||
Attribution.
|
||||
|
||||
If You Share the Licensed Material (including in modified form), You must:
|
||||
|
||||
retain the following if it is supplied by the Licensor with the Licensed
|
||||
Material: identification of the creator(s) of the Licensed Material and
|
||||
any others designated to receive attribution, in any reasonable manner
|
||||
requested by the Licensor (including by pseudonym if designated); a
|
||||
copyright notice; a notice that refers to this Public License; a notice
|
||||
that refers to the disclaimer of warranties; a URI or hyperlink to the
|
||||
Licensed Material to the extent reasonably practicable; indicate if You
|
||||
modified the Licensed Material and retain an indication of any previous
|
||||
modifications; and indicate the Licensed Material is licensed under this
|
||||
Public License, and include the text of, or the URI or hyperlink to,
|
||||
this Public License. You may satisfy the conditions in Section 3(a)(1)
|
||||
in any reasonable manner based on the medium, means, and context in which
|
||||
You Share the Licensed Material. For example, it may be reasonable to
|
||||
satisfy the conditions by providing a URI or hyperlink to a resource
|
||||
that includes the required information. If requested by the Licensor,
|
||||
You must remove any of the information required by Section 3(a)(1)(A)
|
||||
to the extent reasonably practicable. If You Share Adapted Material You
|
||||
produce, the Adapter's License You apply must not prevent recipients of
|
||||
the Adapted Material from complying with this Public License. Section 4
|
||||
– Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that apply
|
||||
to Your use of the Licensed Material:
|
||||
|
||||
for the avoidance of doubt, Section 2(a)(1) grants You the right to
|
||||
extract, reuse, reproduce, and Share all or a substantial portion of the
|
||||
contents of the database; if You include all or a substantial portion of
|
||||
the database contents in a database in which You have Sui Generis Database
|
||||
Rights, then the database in which You have Sui Generis Database Rights
|
||||
(but not its individual contents) is Adapted Material; and You must comply
|
||||
with the conditions in Section 3(a) if You Share all or a substantial
|
||||
portion of the contents of the database. For the avoidance of doubt,
|
||||
this Section 4 supplements and does not replace Your obligations under
|
||||
this Public License where the Licensed Rights include other Copyright and
|
||||
Similar Rights. Section 5 – Disclaimer of Warranties and Limitation
|
||||
of Liability.
|
||||
|
||||
Unless otherwise separately undertaken by the Licensor, to the
|
||||
extent possible, the Licensor offers the Licensed Material as-is and
|
||||
as-available, and makes no representations or warranties of any kind
|
||||
concerning the Licensed Material, whether express, implied, statutory,
|
||||
or other. This includes, without limitation, warranties of title,
|
||||
merchantability, fitness for a particular purpose, non-infringement,
|
||||
absence of latent or other defects, accuracy, or the presence or absence
|
||||
of errors, whether or not known or discoverable. Where disclaimers of
|
||||
warranties are not allowed in full or in part, this disclaimer may not
|
||||
apply to You. To the extent possible, in no event will the Licensor
|
||||
be liable to You on any legal theory (including, without limitation,
|
||||
negligence) or otherwise for any direct, special, indirect, incidental,
|
||||
consequential, punitive, exemplary, or other losses, costs, expenses,
|
||||
or damages arising out of this Public License or use of the Licensed
|
||||
Material, even if the Licensor has been advised of the possibility of
|
||||
such losses, costs, expenses, or damages. Where a limitation of liability
|
||||
is not allowed in full or in part, this limitation may not apply to You.
|
||||
The disclaimer of warranties and limitation of liability provided above
|
||||
shall be interpreted in a manner that, to the extent possible, most
|
||||
closely approximates an absolute disclaimer and waiver of all liability.
|
||||
Section 6 – Term and Termination.
|
||||
|
||||
This Public License applies for the term of the Copyright and Similar
|
||||
Rights licensed here. However, if You fail to comply with this
|
||||
Public License, then Your rights under this Public License terminate
|
||||
automatically. Where Your right to use the Licensed Material has
|
||||
terminated under Section 6(a), it reinstates:
|
||||
|
||||
automatically as of the date the violation is cured, provided it is
|
||||
cured within 30 days of Your discovery of the violation; or upon express
|
||||
reinstatement by the Licensor. For the avoidance of doubt, this Section
|
||||
6(b) does not affect any right the Licensor may have to seek remedies
|
||||
for Your violations of this Public License. For the avoidance of doubt,
|
||||
the Licensor may also offer the Licensed Material under separate terms
|
||||
or conditions or stop distributing the Licensed Material at any time;
|
||||
however, doing so will not terminate this Public License. Sections 1,
|
||||
5, 6, 7, and 8 survive termination of this Public License. Section 7
|
||||
– Other Terms and Conditions.
|
||||
|
||||
The Licensor shall not be bound by any additional or different terms or
|
||||
conditions communicated by You unless expressly agreed. Any arrangements,
|
||||
understandings, or agreements regarding the Licensed Material not stated
|
||||
herein are separate from and independent of the terms and conditions of
|
||||
this Public License. Section 8 – Interpretation.
|
||||
|
||||
For the avoidance of doubt, this Public License does not, and shall not be
|
||||
interpreted to, reduce, limit, restrict, or impose conditions on any use
|
||||
of the Licensed Material that could lawfully be made without permission
|
||||
under this Public License. To the extent possible, if any provision of
|
||||
this Public License is deemed unenforceable, it shall be automatically
|
||||
reformed to the minimum extent necessary to make it enforceable. If
|
||||
the provision cannot be reformed, it shall be severed from this Public
|
||||
License without affecting the enforceability of the remaining terms
|
||||
and conditions. No term or condition of this Public License will be
|
||||
waived and no failure to comply consented to unless expressly agreed
|
||||
to by the Licensor. Nothing in this Public License constitutes or may
|
||||
be interpreted as a limitation upon, or waiver of, any privileges and
|
||||
immunities that apply to the Licensor or You, including from the legal
|
||||
processes of any jurisdiction or authority. Creative Commons is not
|
||||
a party to its public licenses. Notwithstanding, Creative Commons may
|
||||
elect to apply one of its public licenses to material it publishes and
|
||||
in those instances will be considered the “Licensor.” The text of
|
||||
the Creative Commons public licenses is dedicated to the public domain
|
||||
under the CC0 Public Domain Dedication. Except for the limited purpose of
|
||||
indicating that material is shared under a Creative Commons public license
|
||||
or as otherwise permitted by the Creative Commons policies published at
|
||||
creativecommons.org/policies, Creative Commons does not authorize the
|
||||
use of the trademark “Creative Commons” or any other trademark or
|
||||
logo of Creative Commons without its prior written consent including,
|
||||
without limitation, in connection with any unauthorized modifications
|
||||
to any of its public licenses or any other arrangements, understandings,
|
||||
or agreements concerning use of licensed material. For the avoidance of
|
||||
doubt, this paragraph does not form part of the public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
||||
3
vendor/github.com/ajstarks/svgo/LICENSE-link.txt
generated
vendored
Normal file
3
vendor/github.com/ajstarks/svgo/LICENSE-link.txt
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
The contents of this repository are Licensed under
|
||||
the Creative Commons Attribution 4.0 International license as described in
|
||||
https://creativecommons.org/licenses/by/4.0/legalcode
|
||||
727
vendor/github.com/ajstarks/svgo/README.markdown
generated
vendored
Normal file
727
vendor/github.com/ajstarks/svgo/README.markdown
generated
vendored
Normal file
@ -0,0 +1,727 @@
|
||||
# SVGo: A Go library for SVG generation #
|
||||
|
||||
The library 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
|
||||
|
||||
### Animation ###
|
||||
animate, animateMotion, animateTranslate, animateRotate, animateScale, animateSkewX, animateSkewY
|
||||
|
||||
### 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), marker, mask, pattern, title, (a)ddress, link, script, use
|
||||
|
||||
## Building and Usage ##
|
||||
|
||||
See svgdef.[svg|png|pdf] for a graphical view of the function calls
|
||||
|
||||
|
||||
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:
|
||||
|
||||
$ go doc 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()
|
||||
}
|
||||
|
||||
You 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.
|
||||
|
||||
### Graphics Sketching with SVGo and svgplay ###
|
||||
|
||||
Combined with the svgplay command, SVGo can be used to "sketch" with code in a browser.
|
||||
|
||||
To use svgplay and SVGo, first go to a directory with your code, and run:
|
||||
|
||||
$ svgplay
|
||||
2014/06/25 22:05:28 ☠ ☠ ☠ Warning: this server allows a client connecting to 127.0.0.1:1999 to execute code on this computer ☠ ☠ ☠
|
||||
|
||||
Next open your browser to the svgplay server you just started.
|
||||
svgplay only listens on localhost, and uses port 1999 (guess which year SVG was first introduced) by default
|
||||
|
||||
http://localhost:1999/
|
||||
|
||||
Enter your code in the textarea, and when you are ready to run press Shift--Enter. The code will be compiled, with the results
|
||||
on 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.
|
||||
|
||||
|
||||
If you want to sketch with an existing file, enter its URL:
|
||||
|
||||
http://localhost:1999/foo.go
|
||||
|
||||

|
||||
|
||||
|
||||
### SVGo Papers and presentations ###
|
||||
|
||||
* SVGo paper from SVGOpen 2011 <http://www.svgopen.org/2011/papers/34-SVGo_a_Go_Library_for_SVG_generation>
|
||||
|
||||
* Programming Pictures with SVGo <https://speakerdeck.com/u/ajstarks/p/programming-pictures-with-svgo>
|
||||
|
||||
* SVGo Workshop <https://speakerdeck.com/u/ajstarks/p/svgo-workshop>
|
||||
|
||||
|
||||
### Tutorial Video ###
|
||||
|
||||
A video describing how to use the package can be seen on YouTube at <http://www.youtube.com/watch?v=ze6O2Dj5gQ4>
|
||||
|
||||
## Package contents ##
|
||||
|
||||
* svg.go: Library
|
||||
* newsvg: Coding template command
|
||||
* svgdef: Creates a SVG representation of the API
|
||||
* animate: Animation demo
|
||||
* am: Animate motion demo
|
||||
* amt: Animate transformation demo
|
||||
* android: The Android logo
|
||||
* bubtrail: Bubble trails
|
||||
* bulletgraph: Bullet Graphs (via Stephen Few)
|
||||
* colortab: Display SVG named colors with RGB values
|
||||
* compx: Component diagrams
|
||||
* flower: Random "flowers"
|
||||
* fontcompare: Compare two fonts
|
||||
* f50: Get 50 photos from Flickr based on a query
|
||||
* fe: Filter effects
|
||||
* funnel: Funnel from transparent circles
|
||||
* gradient: Linear and radial gradients
|
||||
* html5logo: HTML5 logo with draggable elements
|
||||
* imfade: Show image fading
|
||||
* lewitt: Version of Sol Lewitt's Wall Drawing 91
|
||||
* ltr: Layer Tennis Remixes
|
||||
* marker: Test markers
|
||||
* paths: Demonstrate SVG paths
|
||||
* pattern: Test patterns
|
||||
* planets: Show the scale of the Solar system
|
||||
* pmap: Proportion maps
|
||||
* randcomp: Compare random number generators
|
||||
* richter: Gerhard Richter's 256 colors
|
||||
* rl: Random lines (port of a Processing demo)
|
||||
* skewabc: Skew ABC
|
||||
* stockproduct: Visualize product and stock prices
|
||||
* svgopher: SVGo Mascot
|
||||
* svgplay: SVGo sketching server
|
||||
* svgplot: Plot data
|
||||
* svgrid: Compose SVG files in a grid
|
||||
* tsg: Twitter Search Grid
|
||||
* tumblrgrid: Tumblr picture grid
|
||||
* turbulence: Turbulence filter effect
|
||||
* vismem: Visualize data from files
|
||||
* webfonts: "Hello, World" with Google Web Fonts
|
||||
* websvg: Generate SVG as a web server
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
|
||||
### Structure, Scripting, Metadata, Transformation and Links ###
|
||||
|
||||
New(w io.Writer) *SVG
|
||||
Constructor, Specify the output destination.
|
||||
|
||||
Start(w int, h int, attributes ...string)
|
||||
begin the SVG document with the width w and height h. Optionally add additional elements
|
||||
(such as additional namespaces or scripting events)
|
||||
<http://www.w3.org/TR/SVG11/struct.html#SVGElement>
|
||||
|
||||
Startview(w, h, minx, miny, vw, vh int)
|
||||
begin the SVG document with the width w, height h, with a viewBox at minx, miny, vw, vh.
|
||||
<http://www.w3.org/TR/SVG11/struct.html#SVGElement>
|
||||
|
||||
Startunit(w int, h int, unit string, ns ...string)
|
||||
begin the SVG document, with width and height in the specified units. Optionally add additional elements
|
||||
(such as additional namespaces or scripting events)
|
||||
<http://www.w3.org/TR/SVG11/struct.html#SVGElement>
|
||||
|
||||
|
||||
Startpercent(w int, h int, ns ...string)
|
||||
begin the SVG document, with width and height in percent. Optionally add additional elements
|
||||
(such as additional namespaces or scripting events)
|
||||
<http://www.w3.org/TR/SVG11/struct.html#SVGElement>
|
||||
|
||||
|
||||
StartviewUnit(w, h int, unit string, minx, miny, vw, vh int)
|
||||
begin the SVG document with the width w, height h, in the specified unit, with a viewBox at minx, miny, vw, vh.
|
||||
<http://www.w3.org/TR/SVG11/struct.html#SVGElement>
|
||||
|
||||
End()
|
||||
end the SVG document
|
||||
|
||||
Script(scriptype string, data ...string)
|
||||
Script defines a script with a specified type, (for example "application/javascript").
|
||||
if the first variadic argument is a link, use only the link reference.
|
||||
Otherwise, treat variadic arguments as the text of the script (marked up as CDATA).
|
||||
if no data is specified, simply close the script element.
|
||||
<http://www.w3.org/TR/SVG/script.html>
|
||||
|
||||
Style(scriptype string, data ...string)
|
||||
Style defines a script with a specified type, (for example "text/css").
|
||||
if the first variadic argument is a link, use only the link reference.
|
||||
Otherwise, treat variadic arguments as the text of the script (marked up as CDATA).
|
||||
if no data is specified, simply close the style element.
|
||||
<https://www.w3.org/TR/SVG/styling.html#StyleElement>
|
||||
|
||||
Group(s ...string)
|
||||
begin a group, with arbitrary attributes
|
||||
<http://www.w3.org/TR/SVG11/struct.html#GElement>
|
||||
|
||||
Gstyle(s string)
|
||||
begin a group, with the specified style.
|
||||
<http://www.w3.org/TR/SVG11/struct.html#GElement>
|
||||
|
||||
Gid(s string)
|
||||
begin a group, with the specified id.
|
||||
|
||||
Gtransform(s string)
|
||||
begin a group, with the specified transform, end with Gend().
|
||||
<http://www.w3.org/TR/SVG11/coords.html#TransformAttribute>
|
||||
|
||||
Translate(x, y int)
|
||||
begins coordinate translation to (x,y), end with Gend().
|
||||
<http://www.w3.org/TR/SVG11/coords.html#TransformAttribute>
|
||||
|
||||
Scale(n float64)
|
||||
scales the coordinate system by n, end with Gend().
|
||||
<http://www.w3.org/TR/SVG11/coords.html#TransformAttribute>
|
||||
|
||||
ScaleXY(x, y float64)
|
||||
scales the coordinate system by x, y. End with Gend().
|
||||
<http://www.w3.org/TR/SVG11/coords.html#TransformAttribute>
|
||||
|
||||
SkewX(a float64)
|
||||
SkewX skews the x coordinate system by angle a, end with Gend().
|
||||
<http://www.w3.org/TR/SVG11/coords.html#TransformAttribute>
|
||||
|
||||
SkewY(a float64)
|
||||
SkewY skews the y coordinate system by angle a, end with Gend().
|
||||
<http://www.w3.org/TR/SVG11/coords.html#TransformAttribute>
|
||||
|
||||
SkewXY(ax, ay float64)
|
||||
SkewXY skews x and y coordinate systems by ax, ay respectively, end with Gend().
|
||||
<http://www.w3.org/TR/SVG11/coords.html#TransformAttribute>
|
||||
|
||||
Rotate(r float64)
|
||||
rotates the coordinate system by r degrees, end with Gend().
|
||||
<http://www.w3.org/TR/SVG11/coords.html#TransformAttribute>
|
||||
|
||||
TranslateRotate(x, y int, r float64)
|
||||
translates the coordinate system to (x,y), then rotates to r degrees, end with Gend().
|
||||
|
||||
RotateTranslate(x, y int, r float64)
|
||||
rotates the coordinate system r degrees, then translates to (x,y), end with Gend().
|
||||
|
||||
Gend()
|
||||
end the group (must be paired with Gstyle, Gtransform, Gid).
|
||||
|
||||
ClipPath(s ...string)
|
||||
Begin a ClipPath
|
||||
<http://www.w3.org/TR/SVG/masking.html#ClippingPaths>
|
||||
|
||||
ClipEnd()
|
||||
End a ClipPath
|
||||
<http://www.w3.org/TR/SVG/masking.html#ClippingPaths>
|
||||
|
||||
Def()
|
||||
begin a definition block.
|
||||
<http://www.w3.org/TR/SVG11/struct.html#DefsElement>
|
||||
|
||||
DefEnd()
|
||||
end a definition block.
|
||||
|
||||
Marker(id string, x, y, w, h int, s ...string)
|
||||
define a marker
|
||||
<http://www.w3.org/TR/SVG11/painting.html#MarkerElement>
|
||||
|
||||
|
||||
MarkerEnd()
|
||||
end a marker
|
||||
|
||||
|
||||
Mask(id string, x int, y int, w int, h int, s ...string)
|
||||
creates a mask with a specified id, dimension, and optional style.
|
||||
<http://www.w3.org/TR/SVG/masking.html>
|
||||
|
||||
MaskEnd()
|
||||
ends the Mask element.
|
||||
|
||||
|
||||
Pattern(id string, x, y, width, height int, putype string, s ...string)
|
||||
define 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.
|
||||
<http://www.w3.org/TR/SVG11/pservers.html#Patterns>
|
||||
|
||||
Desc(s string)
|
||||
specify the text of the description.
|
||||
<http://www.w3.org/TR/SVG11/struct.html#DescElement>
|
||||
|
||||
Title(s string)
|
||||
specify the text of the title.
|
||||
<http://www.w3.org/TR/SVG11/struct.html#TitleElement>
|
||||
|
||||
Link(href string, title string)
|
||||
begin a link named "href", with the specified title.
|
||||
<http://www.w3.org/TR/SVG11/linking.html#Links>
|
||||
|
||||
LinkEnd()
|
||||
end the link.
|
||||
|
||||
Use(x int, y int, link string, s ...string)
|
||||
place the object referenced at link at the location x, y.
|
||||
<http://www.w3.org/TR/SVG11/struct.html#UseElement>
|
||||
|
||||
### Shapes ###
|
||||
|
||||
Circle(x int, y int, r int, s ...string)
|
||||
draw a circle, centered at x,y with radius r.
|
||||
<http://www.w3.org/TR/SVG11/shapes.html#CircleElement>
|
||||
|
||||

|
||||
|
||||
Ellipse(x int, y int, w int, h int, s ...string)
|
||||
draw an ellipse, centered at x,y with radii w, and h.
|
||||
<http://www.w3.org/TR/SVG11/shapes.html#EllipseElement>
|
||||
|
||||

|
||||
|
||||
Polygon(x []int, y []int, s ...string)
|
||||
draw a series of line segments using an array of x, y coordinates.
|
||||
<http://www.w3.org/TR/SVG11/shapes.html#PolygonElement>
|
||||
|
||||

|
||||
|
||||
Rect(x int, y int, w int, h int, s ...string)
|
||||
draw a rectangle with upper left-hand corner at x,y, with width w, and height h.
|
||||
<http://www.w3.org/TR/SVG11/shapes.html#RectElement>
|
||||
|
||||

|
||||
|
||||
CenterRect(x int, y int, w int, h int, s ...string)
|
||||
draw a rectangle with its center at x,y, with width w, and height h.
|
||||
|
||||
Roundrect(x int, y int, w int, h int, rx int, ry int, s ...string)
|
||||
draw a rounded rectangle with upper the left-hand corner at x,y,
|
||||
with width w, and height h. The radii for the rounded portion
|
||||
is specified by rx (width), and ry (height).
|
||||
|
||||

|
||||
|
||||
Square(x int, y int, s int, style ...string)
|
||||
draw a square with upper left corner at x,y with sides of length s.
|
||||
|
||||

|
||||
|
||||
### Paths ###
|
||||
|
||||
Path(p string, s ...style)
|
||||
draw the arbitrary path as specified in p, according to the style specified in s. <http://www.w3.org/TR/SVG11/paths.html>
|
||||
|
||||
|
||||
Arc(sx int, sy int, ax int, ay int, r int, large bool, sweep bool, ex int, ey int, s ...string)
|
||||
draw an elliptical arc 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>
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
Bezier(sx int, sy int, cx int, cy int, px int, py int, ex int, ey int, s ...string)
|
||||
draw a cubic bezier curve, beginning at sx,sy, ending at ex,ey
|
||||
with control points at cx,cy and px,py.
|
||||
<http://www.w3.org/TR/SVG11/paths.html#PathDataCubicBezierCommands>
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
Qbezier(sx int, sy int, cx int, cy int, ex int, ey int, tx int, ty int, s ...string)
|
||||
draw a quadratic bezier curve, beginning at sx, sy, ending at tx,ty
|
||||
with control points are at cx,cy, ex,ey.
|
||||
<http://www.w3.org/TR/SVG11/paths.html#PathDataQuadraticBezierCommands>
|
||||
|
||||

|
||||
|
||||
|
||||
Qbez(sx int, sy int, cx int, cy int, ex int, ey int, s...string)
|
||||
draws a quadratic bezier curver, with optional style beginning at sx,sy, ending at ex, sy
|
||||
with the control point at cx, cy.
|
||||
<http://www.w3.org/TR/SVG11/paths.html#PathDataQuadraticBezierCommands>
|
||||
|
||||

|
||||
|
||||
### Lines ###
|
||||
|
||||
Line(x1 int, y1 int, x2 int, y2 int, s ...string)
|
||||
draw a line segment between x1,y1 and x2,y2.
|
||||
<http://www.w3.org/TR/SVG11/shapes.html#LineElement>
|
||||
|
||||

|
||||
|
||||
|
||||
Polyline(x []int, y []int, s ...string)
|
||||
draw a polygon using coordinates specified in x,y arrays.
|
||||
<http://www.w3.org/TR/SVG11/shapes.html#PolylineElement>
|
||||
|
||||

|
||||
|
||||
### Image and Text ###
|
||||
|
||||
Image(x int, y int, w int, h int, link string, s ...string)
|
||||
place at x,y (upper left hand corner), the image with width w, and height h, referenced at link.
|
||||
<http://www.w3.org/TR/SVG11/struct.html#ImageElement>
|
||||
|
||||

|
||||
|
||||
Text(x int, y int, t string, s ...string)
|
||||
Place the specified text, t at x,y according to the style specified in s.
|
||||
<http://www.w3.org/TR/SVG11/text.html#TextElement>
|
||||
|
||||
Textlines(x, y int, s []string, size, spacing int, fill, align string)
|
||||
Places lines of text in s, starting at x,y, at the specified size, fill, and alignment, and spacing.
|
||||
|
||||
Textpath(t string, pathid string, s ...string)
|
||||
places optionally styled text along a previously defined path.
|
||||
<http://www.w3.org/TR/SVG11/text.html#TextPathElement>
|
||||

|
||||
|
||||
### Color ###
|
||||
|
||||
RGB(r int, g int, b int) string
|
||||
creates a style string for the fill color designated
|
||||
by the (r)ed, g(reen), (b)lue components.
|
||||
<http://www.w3.org/TR/css3-color/>
|
||||
|
||||
RGBA(r int, g int, b int, a float64) string
|
||||
as above, but includes the color's opacity as a value
|
||||
between 0.0 (fully transparent) and 1.0 (opaque).
|
||||
|
||||
### Gradients ###
|
||||
|
||||
LinearGradient(id string, x1, y1, x2, y2 uint8, sc []Offcolor)
|
||||
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.
|
||||
<http://www.w3.org/TR/SVG11/pservers.html#LinearGradients>
|
||||

|
||||
|
||||
RadialGradient(id string, cx, cy, r, fx, fy uint8, sc []Offcolor)
|
||||
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.
|
||||
<http://www.w3.org/TR/SVG11/pservers.html#RadialGradients>
|
||||
|
||||

|
||||
|
||||
### Animation ###
|
||||
|
||||
Animate(link, attr string, from, to int, duration float64, repeat int, s ...string)
|
||||
Animate animates the item referenced by the link, using the specified attribute
|
||||
The animation starts at coordinate from, terminates at to, and repeats as specified.
|
||||
Addtional attributes may be added as needed.
|
||||
<https://www.w3.org/TR/SVG11/animate.html#AnimateElement>
|
||||
|
||||
AnimateMotion(link, path string, duration float64, repeat int, s ...string)
|
||||
AnimateMotion animates the referenced object ```link``` along the specified ```path```
|
||||
<https://www.w3.org/TR/SVG11/animate.html#AnimateMotionElement>
|
||||
|
||||
|
||||
AnimateTranslate(link string, fx, fy, tx, ty int, duration float64, repeat int, s ...string)
|
||||
AnimateTranslate animates the translation transformation (link refers to the object to animate, fx, fy are from coordinates, tx, ty are the to coordinates)
|
||||
<https://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement>
|
||||
|
||||
AnimateRotate(link string, fs, fc, fe, ts, tc, te int, duration float64, repeat int, s ...string)
|
||||
AnimateRotate 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
|
||||
start, center, and end angles)
|
||||
<https://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement>
|
||||
|
||||
|
||||
AnimateScale(link string, from, to, duration float64, repeat int, s ...string)
|
||||
AnimateScale animates the scale transformation (link refers to the object to animate, from and to specify the scaling factor)
|
||||
<https://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement>
|
||||
|
||||
|
||||
AnimateSkewX(link string, from, to, duration float64, repeat int, s ...string)
|
||||
AnimateSkewX animates the skewX transformation ((link refers to the object to animate, from and to specify the skew angle)
|
||||
<https://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement>
|
||||
|
||||
|
||||
AnimateSkewY(link string, from, to, duration float64, repeat int, s ...string)
|
||||
AnimateSkewY animates the skewY transformation (link refers to the object to animate, and from and to specify the skew angle)
|
||||
<https://www.w3.org/TR/SVG11/animate.html#AnimateTransformElement>
|
||||
|
||||
|
||||
### Filter Effects ###
|
||||
|
||||
Filter(id string, s ...string)
|
||||
Filter begins a filter set
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#FilterElement>
|
||||
|
||||
Fend()
|
||||
Fend ends a filter set
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#FilterElement>
|
||||
|
||||
FeBlend(fs Filterspec, mode string, s ...string)
|
||||
FeBlend specifies a Blend filter primitive
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feBlendElement>
|
||||
|
||||
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>
|
||||
|
||||
FeColorMatrixHue(fs Filterspec, value float64, s ...string)
|
||||
FeColorMatrix specifies a color matrix filter primitive, with hue values
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement>
|
||||
|
||||
FeColorMatrixSaturate(fs Filterspec, value float64, s ...string)
|
||||
FeColorMatrix specifies a color matrix filter primitive, with saturation values
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement>
|
||||
|
||||
FeColorMatrixLuminence(fs Filterspec, s ...string)
|
||||
FeColorMatrix specifies a color matrix filter primitive, with luminence values
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement>
|
||||
|
||||
FeComponentTransfer()
|
||||
FeComponentTransfer begins a feComponent filter Element>
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement>
|
||||
|
||||
FeCompEnd()
|
||||
FeCompEnd ends a feComponent filter Element>
|
||||
|
||||
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>
|
||||
|
||||
FeConvolveMatrix(fs Filterspec, matrix [9]int, s ...string)
|
||||
FeConvolveMatrix specifies a feConvolveMatrix filter primitive
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feConvolveMatrixElement>
|
||||
|
||||
|
||||
FeDiffuseLighting(fs Filterspec, scale, constant float64, s ...string)
|
||||
FeDiffuseLighting specifies a diffuse lighting filter primitive,
|
||||
a container for light source Element>s, end with DiffuseEnd()
|
||||
|
||||
FeDiffEnd()
|
||||
FeDiffuseEnd ends a diffuse lighting filter primitive container
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feDiffuseLightingElement>
|
||||
|
||||
|
||||
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>
|
||||
|
||||
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>
|
||||
|
||||
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>
|
||||
|
||||
FeFuncLinear(channel string, slope, intercept float64)
|
||||
FeFuncLinear is the linear form of feFunc
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement>
|
||||
|
||||
FeFuncGamma(channel, amplitude, exponent, offset float64)
|
||||
FeFuncGamma is the gamma curve form of feFunc
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement>
|
||||
|
||||
FeFuncTable(channel string, tv []float64)
|
||||
FeFuncGamma is the form of feFunc using a table of values
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement>
|
||||
|
||||
FeFuncDiscrete(channel string, tv []float64)
|
||||
FeFuncGamma is the form of feFunc using discrete values
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feComponentTransferElement>
|
||||
|
||||
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>
|
||||
|
||||
FeImage(href string, result string, s ...string)
|
||||
FeImage specifies a feImage filter primitive
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feImageElement>
|
||||
|
||||
FeMerge(nodes []string, s ...string)
|
||||
FeMerge specifies a feMerge filter primitive, containing feMerge Element>s
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feMergeElement>
|
||||
|
||||
FeMorphology(fs Filterspec, operator string, xradius, yradius float64, s ...string)
|
||||
FeMorphologyLight specifies a feMorphologyLight filter primitive
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feMorphologyElement>
|
||||
|
||||
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>
|
||||
|
||||
FePointLight(x, y, z float64, s ...string)
|
||||
FePointLight specifies a fePpointLight filter primitive
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#fePointLightElement>
|
||||
|
||||
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()
|
||||
|
||||
|
||||
FeSpecEnd()
|
||||
FeSpecularEnd ends a specular lighting filter primitive container
|
||||
Standard reference: <http://www.w3.org/TR/SVG11/filters.html#feSpecularLightingElement>
|
||||
|
||||
|
||||
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>
|
||||
|
||||
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>
|
||||
|
||||
|
||||
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>
|
||||
|
||||
### Filter convenience functions (modeled on CSS filter effects) ###
|
||||
|
||||
Blur(p float64)
|
||||
Blur function by standard deviation
|
||||
|
||||
Brightness(p float64)
|
||||
Brightness function (0-100)
|
||||
|
||||
Grayscale()
|
||||
Apply a grayscale filter to the image
|
||||
|
||||
HueRotate(a float64)
|
||||
Rotate Hues (0-360 degrees)
|
||||
|
||||
Invert()
|
||||
Invert the image's colors
|
||||
|
||||
Saturate(p float64)
|
||||
Percent saturation, 0 is grayscale
|
||||
|
||||
Sepia()
|
||||
Apply sepia tone
|
||||
|
||||
|
||||
### Utility ###
|
||||
|
||||
Grid(x int, y int, w int, h int, n int, s ...string)
|
||||
draws a grid of straight lines starting at x,y, with a width w, and height h, and a size of n.
|
||||
|
||||

|
||||
|
||||
### Credits ###
|
||||
|
||||
Thanks to Jonathan Wright for the io.Writer update.
|
||||
126
vendor/github.com/ajstarks/svgo/doc.go
generated
vendored
Normal file
126
vendor/github.com/ajstarks/svgo/doc.go
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
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
|
||||
BIN
vendor/github.com/ajstarks/svgo/gophercolor128x128.png
generated
vendored
Normal file
BIN
vendor/github.com/ajstarks/svgo/gophercolor128x128.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
39
vendor/github.com/ajstarks/svgo/newsvg
generated
vendored
Normal file
39
vendor/github.com/ajstarks/svgo/newsvg
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
if test $# -lt 1
|
||||
then
|
||||
echo "specify a file"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if test ! -f $1
|
||||
then
|
||||
cat <<! > $1
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/ajstarks/svgo"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
width = 500
|
||||
height = 500
|
||||
canvas = svg.New(os.Stdout)
|
||||
)
|
||||
|
||||
func background(v int) { canvas.Rect(0, 0, width, height, canvas.RGB(v, v, v)) }
|
||||
|
||||
|
||||
func main() {
|
||||
canvas.Start(width, height)
|
||||
background(255)
|
||||
|
||||
// your code here
|
||||
|
||||
canvas.Grid(0, 0, width, height, 10, "stroke:black;opacity:0.1")
|
||||
canvas.End()
|
||||
}
|
||||
!
|
||||
fi
|
||||
$EDITOR $1
|
||||
1055
vendor/github.com/ajstarks/svgo/svg.go
generated
vendored
Normal file
1055
vendor/github.com/ajstarks/svgo/svg.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
vendor/github.com/ajstarks/svgo/svgdef.pdf
generated
vendored
Normal file
BIN
vendor/github.com/ajstarks/svgo/svgdef.pdf
generated
vendored
Normal file
Binary file not shown.
BIN
vendor/github.com/ajstarks/svgo/svgdef.png
generated
vendored
Normal file
BIN
vendor/github.com/ajstarks/svgo/svgdef.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 412 KiB |
395
vendor/github.com/ajstarks/svgo/svgdef.svg
generated
vendored
Normal file
395
vendor/github.com/ajstarks/svgo/svgdef.svg
generated
vendored
Normal file
@ -0,0 +1,395 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- Generated by SVGo -->
|
||||
<svg width="4500" height="3375"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<desc>Object Definitions</desc>
|
||||
<defs>
|
||||
<linearGradient id="linear" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||
<stop offset="0%" stop-color="white" stop-opacity="1.00"/>
|
||||
<stop offset="25%" stop-color="lightblue" stop-opacity="1.00"/>
|
||||
<stop offset="75%" stop-color="blue" stop-opacity="1.00"/>
|
||||
<stop offset="100%" stop-color="rgb(0,0,127)" stop-opacity="1.00"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="radial" cx="0%" cy="0%" r="100%" fx="50%" fy="50%">
|
||||
<stop offset="0%" stop-color="white" stop-opacity="1.00"/>
|
||||
<stop offset="25%" stop-color="lightblue" stop-opacity="1.00"/>
|
||||
<stop offset="75%" stop-color="blue" stop-opacity="1.00"/>
|
||||
<stop offset="100%" stop-color="rgb(0,0,127)" stop-opacity="1.00"/>
|
||||
</radialGradient>
|
||||
<path d="M 0,0 A62,62 0 0 1 250,0" id="tpath" />
|
||||
<g id="square">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<rect x="0" y="0" width="125" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="62" y="-24" style="fill:gray; text-anchor:middle">w</text>
|
||||
<text x="62" y="149" style="fill:black; text-anchor:middle;font-size:24px">Square(x, y, w int, style ...string)</text>
|
||||
</g>
|
||||
<g id="rect">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="-24" y="62" style="fill:gray; text-anchor:middle">h</text>
|
||||
<text x="125" y="-24" style="fill:gray; text-anchor:middle">w</text>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Rect(x, y, w, h int, style ...string)</text>
|
||||
</g>
|
||||
<g id="crect">
|
||||
<circle cx="125" cy="62" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="125" y="38" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="-24" y="62" style="fill:gray; text-anchor:middle">h</text>
|
||||
<text x="125" y="-24" style="fill:gray; text-anchor:middle">w</text>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">CenterRect(x, y, w, h int, style ...string)</text>
|
||||
</g>
|
||||
<g id="roundrect">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<rect x="0" y="0" width="250" height="125" rx="25" ry="25" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="-24" y="62" style="fill:gray; text-anchor:middle">h</text>
|
||||
<text x="125" y="-24" style="fill:gray; text-anchor:middle">w</text>
|
||||
<line x1="25" y1="0" x2="25" y2="25" style="stroke:black; stroke-width:1"/>
|
||||
<line x1="0" y1="25" x2="25" y2="25" style="stroke:black; stroke-width:1"/>
|
||||
<text x="49" y="13" style="fill:gray; text-anchor:middle">ry</text>
|
||||
<text x="12" y="49" style="fill:gray; text-anchor:middle">rx</text>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Roundrect(x, y, w, h, rx, ry int, style ...string)</text>
|
||||
</g>
|
||||
<g id="polygon">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<circle cx="125" cy="-31" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="125" y="-55" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<circle cx="250" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="250" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<circle cx="250" cy="93" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="250" y="69" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<circle cx="125" cy="62" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="125" y="38" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<circle cx="0" cy="93" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="69" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<polygon points="0,0 125,-31 250,0 250,93 125,62 0,93" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Polygon(x, y []int, style ...string)</text>
|
||||
</g>
|
||||
<g id="circle">
|
||||
<g transform="translate(125,62)">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<circle cx="0" cy="0" r="62" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<line x1="0" y1="0" x2="62" y2="0" style="stroke:black; stroke-width:1"/>
|
||||
<text x="31" y="24" style="fill:gray; text-anchor:middle">r</text>
|
||||
<text x="0" y="86" style="fill:black; text-anchor:middle;font-size:24px">Circle(x, y, r int, style ...string)</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="ellipse">
|
||||
<g transform="translate(125,62)">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<ellipse cx="0" cy="0" rx="125" ry="62" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<line x1="0" y1="0" x2="125" y2="0" style="stroke:black; stroke-width:1"/>
|
||||
<line x1="0" y1="0" x2="0" y2="62" style="stroke:black; stroke-width:1"/>
|
||||
<text x="62" y="24" style="fill:gray; text-anchor:middle">rx</text>
|
||||
<text x="-24" y="31" style="fill:gray; text-anchor:middle">ry</text>
|
||||
<text x="0" y="86" style="fill:black; text-anchor:middle;font-size:24px">Ellipse(x, y, rx, ry int, style ...string)</text>
|
||||
</g>
|
||||
</g>
|
||||
<g id="line">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x1, y1</text>
|
||||
<circle cx="250" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="250" y="-24" style="fill:gray; text-anchor:middle">x2, y2</text>
|
||||
<line x1="0" y1="0" x2="250" y2="0" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Line(x1, y1, x2, y2 int, style ...string)</text>
|
||||
</g>
|
||||
<g id="polyline">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<circle cx="83" cy="-62" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="83" y="-86" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<circle cx="187" cy="-41" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="187" y="-65" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<circle cx="250" cy="-125" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="250" y="-149" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<polyline points="0,0 83,-62 187,-41 250,-125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Polyline(x, y []int, style ...string)</text>
|
||||
</g>
|
||||
<g id="arc">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">sx, sy</text>
|
||||
<circle cx="250" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="250" y="-24" style="fill:gray; text-anchor:middle">ex, ey</text>
|
||||
<path d="M0,0 A62,62 0 0 1 250,0" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="125" y="148" style="fill:black; text-anchor:middle;font-size:24px">Arc(sx, sy, ax, ay, r int, lflag, sflag bool, ex, ey int, style ...string)</text>
|
||||
</g>
|
||||
<g id="path">
|
||||
<path d="M36,5l12,41l12-41h33v4l-13,21c30,10,2,69-21,28l7-2c15,27,33,-22,3,-19v-4l12-20h-15l-17,59h-1l-13-42l-12,42h-1l-20-67h9l12,41l8-28l-4-13h9" fill="rgb(0,0,127)" />
|
||||
<path d="M94,53c15,32,30,14,35,7l-1-7c-16,26-32,3-34,0M122,16c-10-21-34,0-21,30c-5-30 16,-38 23,-21l5-10l-2-9" style="fill-opacity:0.50; fill:rgb(0,0,0)"/>
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<text x="62" y="160" style="fill:black; text-anchor:middle;font-size:24px">Path(s string, style ...string)</text>
|
||||
</g>
|
||||
<g id="qbez">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">sx, sy</text>
|
||||
<circle cx="41" cy="-93" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="41" y="-117" style="fill:gray; text-anchor:middle">cx, cy</text>
|
||||
<circle cx="250" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="250" y="-24" style="fill:gray; text-anchor:middle">ex, ey</text>
|
||||
<path d="M0,0 Q41,-93 250,0" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Qbez(sx, sy, cx, cy, ex, ey int, style ...string)</text>
|
||||
</g>
|
||||
<g id="bezier">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">sx, sy</text>
|
||||
<circle cx="125" cy="-62" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="125" y="-86" style="fill:gray; text-anchor:middle">cx, cy</text>
|
||||
<circle cx="125" cy="62" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="125" y="38" style="fill:gray; text-anchor:middle">px, py</text>
|
||||
<circle cx="250" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="250" y="-24" style="fill:gray; text-anchor:middle">ex, ey</text>
|
||||
<path d="M0,0 C125,-62 125,62 250,0" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Bezier(sx, sy, cx, cy, px, py, ex, ey int, style ...string)</text>
|
||||
</g>
|
||||
<g id="image">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<rect x="0" y="0" width="128" height="128" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<text x="-24" y="64" style="fill:gray; text-anchor:middle">h</text>
|
||||
<text x="64" y="-24" style="fill:gray; text-anchor:middle">w</text>
|
||||
<image x="0" y="0" width="128" height="128" xlink:href="gophercolor128x128.png" />
|
||||
<text x="64" y="152" style="fill:black; text-anchor:middle;font-size:24px">Image(x, y, w, h, int path string, style ...string)</text>
|
||||
</g>
|
||||
<g id="lgrad">
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:url(#linear)"/>
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x1%, y1%</text>
|
||||
<circle cx="250" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="250" y="-24" style="fill:gray; text-anchor:middle">x2%, y2%</text>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">LinearGradient(s string, x1, y1, x2, y2 uint8, oc []Offcolor)</text>
|
||||
</g>
|
||||
<g id="rgrad">
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:url(#radial)"/>
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">cx%, cy%</text>
|
||||
<circle cx="125" cy="62" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="125" y="38" style="fill:gray; text-anchor:middle">fx%, fy%</text>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">RadialGradient(s string, cx, cy, r, fx, fy uint8, oc []Offcolor)</text>
|
||||
</g>
|
||||
<g id="trans">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">0, 0</text>
|
||||
<circle cx="167" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="167" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Translate(x, y int)</text>
|
||||
<rect x="0" y="0" width="83" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<g transform="translate(167,0)">
|
||||
<rect x="0" y="0" width="83" height="125" style="fill-opacity:0.25;fill:rgb(0,0,127)"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="grid">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<text x="-24" y="62" style="fill:gray; text-anchor:middle">h</text>
|
||||
<text x="125" y="-24" style="fill:gray; text-anchor:middle">w</text>
|
||||
<text x="55" y="15" style="fill:gray; text-anchor:middle">n</text>
|
||||
<g style="stroke:rgb(0,0,127)">
|
||||
<line x1="0" y1="0" x2="0" y2="125" />
|
||||
<line x1="31" y1="0" x2="31" y2="125" />
|
||||
<line x1="62" y1="0" x2="62" y2="125" />
|
||||
<line x1="93" y1="0" x2="93" y2="125" />
|
||||
<line x1="124" y1="0" x2="124" y2="125" />
|
||||
<line x1="155" y1="0" x2="155" y2="125" />
|
||||
<line x1="186" y1="0" x2="186" y2="125" />
|
||||
<line x1="217" y1="0" x2="217" y2="125" />
|
||||
<line x1="248" y1="0" x2="248" y2="125" />
|
||||
<line x1="0" y1="0" x2="250" y2="0" />
|
||||
<line x1="0" y1="31" x2="250" y2="31" />
|
||||
<line x1="0" y1="62" x2="250" y2="62" />
|
||||
<line x1="0" y1="93" x2="250" y2="93" />
|
||||
<line x1="0" y1="124" x2="250" y2="124" />
|
||||
</g>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Grid(x, y, w, h, n int, style ...string)</text>
|
||||
</g>
|
||||
<g id="text">
|
||||
<circle cx="0" cy="62" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="86" style="fill:gray; text-anchor:middle">x, y</text>
|
||||
<text x="0" y="62" style="text-anchor:start;font-size:32pt">hello, this is SVG</text>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Text(x, y int, s string, style ...string)</text>
|
||||
</g>
|
||||
<g id="scale">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">0, 0</text>
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<g transform="scale(0.5)">
|
||||
<rect x="0" y="0" width="250" height="125" style="fill-opacity:0.25;fill:rgb(0,0,127)"/>
|
||||
</g>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Scale(n float64)</text>
|
||||
</g>
|
||||
<g id="scalexy">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">0, 0</text>
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<g transform="scale(0.5,0.75)">
|
||||
<rect x="0" y="0" width="250" height="125" style="fill-opacity:0.25;fill:rgb(0,0,127)"/>
|
||||
</g>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">ScaleXY(x, y float64)</text>
|
||||
</g>
|
||||
<g id="skewx">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">0, 0</text>
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<g transform="skewX(30)">
|
||||
<rect x="0" y="0" width="250" height="125" style="fill-opacity:0.25;fill:rgb(0,0,127)"/>
|
||||
</g>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">SkewX(a float64)</text>
|
||||
</g>
|
||||
<g id="skewy">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">0, 0</text>
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<g transform="skewY(10)">
|
||||
<rect x="0" y="0" width="250" height="125" style="fill-opacity:0.25;fill:rgb(0,0,127)"/>
|
||||
</g>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">SkewY(a float64)</text>
|
||||
</g>
|
||||
<g id="skewxy">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">0, 0</text>
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<g transform="skewX(10) skewY(10)">
|
||||
<rect x="0" y="0" width="250" height="125" style="fill-opacity:0.25;fill:rgb(0,0,127)"/>
|
||||
</g>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">SkewXY(x, y float64)</text>
|
||||
</g>
|
||||
<g id="rotate">
|
||||
<circle cx="0" cy="0" r="4" style="fill:rgb(220,220,220)"/>
|
||||
<text x="0" y="-24" style="fill:gray; text-anchor:middle">0, 0</text>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Rotate(r float64)</text>
|
||||
<rect x="0" y="0" width="250" height="125" style="fill:none; stroke-width:2;stroke:rgb(0,0,127)"/>
|
||||
<path d="M125,0 Q135,31 108,62" style="fill:none;stroke:gray"/>
|
||||
<text x="62" y="24" style="fill:gray; text-anchor:middle">r</text>
|
||||
<g transform="rotate(30)">
|
||||
<rect x="0" y="0" width="250" height="125" style="fill-opacity:0.25;fill:rgb(0,0,127)"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="textpath">
|
||||
<text fill="rgb(0,0,127)" text-anchor="start" font-size="16pt" ><textPath xlink:href="#tpath">It's "fine" & "dandy" to draw text along a path</textPath></text>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">Textpath(s, pathid string, style ...string)</text>
|
||||
</g>
|
||||
<g id="meta">
|
||||
<g style="font-size:24px;fill:black;text-anchor:start">
|
||||
<text x="0" y="24" >New(w io Writer)</text>
|
||||
<text x="0" y="52" >Start(w, h int, options ...string)/End()</text>
|
||||
<text x="0" y="80" >Startview(w, h, minx, miny, vw, vh int)</text>
|
||||
<text x="0" y="108" >Group(s ...string)/Gend()</text>
|
||||
<text x="0" y="136" >Gstyle(s string)/Gend()</text>
|
||||
<text x="0" y="164" >Gtransform(s string)/Gend()</text>
|
||||
<text x="0" y="192" >Gid(id string)/Gend()</text>
|
||||
<text x="0" y="220" >ClipPath(s ...string)/ClipEnd()</text>
|
||||
<text x="0" y="248" >Def()/DefEnd()</text>
|
||||
<text x="0" y="276" >Marker()/MarkerEnd()</text>
|
||||
<text x="0" y="304" >Pattern()/PatternEnd()</text>
|
||||
<text x="0" y="332" >Desc(s string)</text>
|
||||
<text x="0" y="360" >Title(s string)</text>
|
||||
<text x="0" y="388" >Script(type, data ...string)</text>
|
||||
<text x="0" y="416" >Mask(id string, x,y,w,h int, style ...string)/MaskEnd()</text>
|
||||
<text x="0" y="444" >Link(href string, title string)/LinkEnd()</text>
|
||||
<text x="0" y="472" >Use(x int, y int, link string, style ...string)</text>
|
||||
</g>
|
||||
<g style="font-size:24px;fill:rgb(127,127,127);text-anchor:start">
|
||||
<text x="650" y="24" >specify destination</text>
|
||||
<text x="650" y="52" >begin/end the document</text>
|
||||
<text x="650" y="80" >begin/end the document with viewport</text>
|
||||
<text x="650" y="108" >begin/end group with attributes</text>
|
||||
<text x="650" y="136" >begin/end group style</text>
|
||||
<text x="650" y="164" >begin/end group transform</text>
|
||||
<text x="650" y="192" >begin/end group id</text>
|
||||
<text x="650" y="220" >begin/end clip path</text>
|
||||
<text x="650" y="248" >begin/end a defintion block</text>
|
||||
<text x="650" y="276" >begin/end markers</text>
|
||||
<text x="650" y="304" >begin/end pattern</text>
|
||||
<text x="650" y="332" >set the description element</text>
|
||||
<text x="650" y="360" >set the title element</text>
|
||||
<text x="650" y="388" >define a script</text>
|
||||
<text x="650" y="416" >begin/end mask element</text>
|
||||
<text x="650" y="444" >begin/end link to href, with a title</text>
|
||||
<text x="650" y="472" >use defined objects</text>
|
||||
</g>
|
||||
<text x="500" y="534" style="fill:black; text-anchor:middle;font-size:24px">Textlines(x, y int, s []string, size, spacing int, fill, align string)</text>
|
||||
</g>
|
||||
<g id="rgb">
|
||||
<g style="fill:gray; text-anchor:middle">
|
||||
<circle cx="62" cy="0" r="15" style="fill:rgb(44,0,0)"/>
|
||||
<circle cx="125" cy="0" r="15" style="fill:rgb(0,77,0)"/>
|
||||
<circle cx="187" cy="0" r="15" style="fill:rgb(0,0,232)"/>
|
||||
<circle cx="250" cy="0" r="15" style="fill:rgb(44,77,232)"/>
|
||||
<text x="62" y="62" >r</text>
|
||||
<text x="125" y="62" >g</text>
|
||||
<text x="187" y="62" >b</text>
|
||||
<text x="219" y="8" >-></text>
|
||||
</g>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">RGB(r, g, b int)</text>
|
||||
</g>
|
||||
<g id="rgba">
|
||||
<g style="fill:gray; text-anchor:middle">
|
||||
<circle cx="62" cy="0" r="15" style="fill:rgb(44,0,0)"/>
|
||||
<circle cx="125" cy="0" r="15" style="fill:rgb(0,77,0)"/>
|
||||
<circle cx="187" cy="0" r="15" style="fill:rgb(0,0,232)"/>
|
||||
<circle cx="250" cy="0" r="15" style="fill-opacity:0.33; fill:rgb(44,77,232)"/>
|
||||
<circle cx="260" cy="0" r="15" style="fill-opacity:0.33; fill:rgb(44,77,232)"/>
|
||||
<text x="250" y="62" >alpha</text>
|
||||
<text x="62" y="62" >r</text>
|
||||
<text x="125" y="62" >g</text>
|
||||
<text x="187" y="62" >b</text>
|
||||
<text x="219" y="8" >-></text>
|
||||
</g>
|
||||
<text x="125" y="149" style="fill:black; text-anchor:middle;font-size:24px">RGBA(r, g, b int, opacity float64)</text>
|
||||
</g>
|
||||
</defs>
|
||||
<title>SVG Go Library Description</title>
|
||||
<rect x="0" y="0" width="4500" height="3375" style="fill:white;stroke:black;stroke-width:2"/>
|
||||
<g style="font-family:Calibri,sans; text-anchor:middle; font-size:24px">
|
||||
<a xlink:href="http://github.com/ajstarks/svgo" xlink:title="SVGo Library">
|
||||
<text x="2250" y="150" style="font-size:125px">SVG Go Library</text>
|
||||
<text x="2250" y="200" style="font-size:50px;fill:gray">github.com/ajstarks/svgo</text>
|
||||
</a>
|
||||
<desc>Object Usage</desc>
|
||||
<g transform="translate(400,400)">
|
||||
<use x="0" y="0" xlink:href="#rect" />
|
||||
<use x="700" y="0" xlink:href="#crect" />
|
||||
<use x="1400" y="0" xlink:href="#roundrect" />
|
||||
<use x="2100" y="0" xlink:href="#square" />
|
||||
<use x="2800" y="0" xlink:href="#line" />
|
||||
<use x="3500" y="0" xlink:href="#polyline" />
|
||||
</g>
|
||||
<g transform="translate(400,1000)">
|
||||
<use x="0" y="0" xlink:href="#polygon" />
|
||||
<use x="700" y="0" xlink:href="#circle" />
|
||||
<use x="1400" y="0" xlink:href="#ellipse" />
|
||||
<use x="2100" y="0" xlink:href="#arc" />
|
||||
<use x="2800" y="0" xlink:href="#qbez" />
|
||||
<use x="3500" y="0" xlink:href="#bezier" />
|
||||
</g>
|
||||
<g transform="translate(400,1600)">
|
||||
<use x="0" y="0" xlink:href="#trans" />
|
||||
<use x="700" y="0" xlink:href="#scale" />
|
||||
<use x="1400" y="0" xlink:href="#scalexy" />
|
||||
<use x="2100" y="0" xlink:href="#skewx" />
|
||||
<use x="2800" y="0" xlink:href="#skewy" />
|
||||
<use x="3500" y="0" xlink:href="#skewxy" />
|
||||
</g>
|
||||
<g transform="translate(400,2200)">
|
||||
<use x="0" y="0" xlink:href="#rotate" />
|
||||
<use x="700" y="0" xlink:href="#text" />
|
||||
<use x="1400" y="0" xlink:href="#textpath" />
|
||||
<use x="2100" y="0" xlink:href="#path" />
|
||||
<use x="2800" y="0" xlink:href="#image" />
|
||||
<use x="3500" y="0" xlink:href="#grid" />
|
||||
</g>
|
||||
<g transform="translate(400,2800)">
|
||||
<use x="0" y="0" xlink:href="#lgrad" />
|
||||
<use x="700" y="0" xlink:href="#rgrad" />
|
||||
<use x="1400" y="0" xlink:href="#rgb" />
|
||||
<use x="2100" y="0" xlink:href="#rgba" />
|
||||
<use x="2800" y="0" xlink:href="#meta" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 21 KiB |
Reference in New Issue
Block a user