url2svg

package
v0.1.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

package url2svg ...

forked from github.com/aaronarduino/goqrsvg boomuler/barcode This is an package internal minial code size | api stability fork! Please use always the original!

github.com/aaronarduino/goqrsvg - Copyright (c) 2017 Aaron Alexander MIT License github.com/boomuler/barcode - Copyright (c) 2014 Florian Sundermann MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	// TypeAztec ...
	TypeAztec           = "Aztec"
	TypeCodabar         = "Codabar"
	TypeCode128         = "Code 128"
	TypeCode39          = "Code 39"
	TypeCode93          = "Code 93"
	TypeDataMatrix      = "DataMatrix"
	TypeEAN8            = "EAN 8"
	TypeEAN13           = "EAN 13"
	TypePDF             = "PDF417"
	TypeQR              = "QR Code"
	Type2of5            = "2 of 5"
	Type2of5Interleaved = "2 of 5 (interleaved)"
)

const

Variables

This section is empty.

Functions

func GetSVG

func GetSVG(u *url.URL) string

GetSVG returns an svg qr code from net/url

func GetStringSVG

func GetStringSVG(in string) string

GetStringSVG returns an svg qr code from string

func IntToRune

func IntToRune(i int) rune

IntToRune converts a digit 0 - 9 to the rune '0' - '9'. If the given int is outside of this range 'F' is returned!

func RuneToInt

func RuneToInt(r rune) int

RuneToInt converts a rune between '0' and '9' to an integer between 0 and 9 If the rune is outside of this range -1 is returned.

Types

type Barcode

type Barcode interface {
	image.Image
	// returns some meta information about the barcode
	Metadata() Metadata
	// the data that was encoded in this barcode
	Content() string
}

Barcode ... a rendered and encoded barcode

func Encode

func Encode(content string, level ErrorCorrectionLevel, mode Encoding) (Barcode, error)

Encode returns a QR barcode with the given content, error correction level and uses the given encoding

func New1DCode

func New1DCode(codeKind, content string, bars *BitList) Barcode

New1DCode creates a new 1D barcode where the bars are represented by the bits in the bars BitList

func Scale

func Scale(bc Barcode, width, height int) (Barcode, error)

Scale returns a resized barcode with the given width and height.

type BarcodeIntCS

type BarcodeIntCS interface {
	Barcode
	CheckSum() int
}

BarcodeIntCS ... Additional interface that some barcodes might implement to provide the value of its checksum.

func New1DCodeIntCheckSum

func New1DCodeIntCheckSum(codeKind, content string, bars *BitList, checksum int) BarcodeIntCS

New1DCodeIntCheckSum creates a new 1D barcode where the bars are represented by the bits in the bars BitList

type BitList

type BitList struct {
	// contains filtered or unexported fields
}

BitList is a list that contains bits

func NewBitList

func NewBitList(capacity int) *BitList

NewBitList returns a new BitList with the given length all bits are initialize with false

func (*BitList) AddBit

func (bl *BitList) AddBit(bits ...bool)

AddBit appends the given bits to the end of the list

func (*BitList) AddBits

func (bl *BitList) AddBits(b int, count byte)

AddBits appends the last (LSB) 'count' bits of 'b' the the end of the list

func (*BitList) AddByte

func (bl *BitList) AddByte(b byte)

AddByte appends all 8 bits of the given byte to the end of the list

func (*BitList) GetBit

func (bl *BitList) GetBit(index int) bool

GetBit returns the bit at the given index

func (*BitList) GetBytes

func (bl *BitList) GetBytes() []byte

GetBytes returns all bits of the BitList as a []byte

func (*BitList) IterateBytes

func (bl *BitList) IterateBytes() <-chan byte

IterateBytes iterates through all bytes contained in the BitList

func (*BitList) Len

func (bl *BitList) Len() int

Len returns the number of contained bits

func (*BitList) SetBit

func (bl *BitList) SetBit(index int, value bool)

SetBit sets the bit at the given index to the given value

type Encoding

type Encoding byte

Encoding mode for QR Codes.

const (
	// Auto will choose ths best matching encoding
	Auto Encoding = iota
	// Numeric encoding only encodes numbers [0-9]
	Numeric
	// AlphaNumeric encoding only encodes uppercase letters, numbers and  [Space], $, %, *, +, -, ., /, :
	AlphaNumeric
	// Unicode encoding encodes the string as utf-8
	Unicode
)

func (Encoding) String

func (e Encoding) String() string

type ErrorCorrectionLevel

type ErrorCorrectionLevel byte

ErrorCorrectionLevel indicates the amount of "backup data" stored in the QR code

const (
	// L recovers 7% of data
	L ErrorCorrectionLevel = iota
	// M recovers 15% of data
	M
	// Q recovers 25% of data
	Q
	// H recovers 30% of data
	H
)

func (ErrorCorrectionLevel) String

func (ecl ErrorCorrectionLevel) String() string

type Filterspec

type Filterspec struct {
	In, In2, Result string
}

Filterspec defines the specification of SVG filters

type GFPoly

type GFPoly struct {
	Coefficients []int
	// contains filtered or unexported fields
}

GFPoly ...

func NewGFPoly

func NewGFPoly(field *GaloisField, coefficients []int) *GFPoly

NewGFPoly ...

func NewMonominalPoly

func NewMonominalPoly(field *GaloisField, degree, coeff int) *GFPoly

NewMonominalPoly ...

func (*GFPoly) AddOrSubstract

func (gp *GFPoly) AddOrSubstract(other *GFPoly) *GFPoly

AddOrSubstract ...

func (*GFPoly) Degree

func (gp *GFPoly) Degree() int

Degree ..

func (*GFPoly) Divide

func (gp *GFPoly) Divide(other *GFPoly) (quotient, remainder *GFPoly)

Divide ...

func (*GFPoly) GetCoefficient

func (gp *GFPoly) GetCoefficient(degree int) int

GetCoefficient returns the coefficient of x ^ degree

func (*GFPoly) MultByMonominal

func (gp *GFPoly) MultByMonominal(degree, coeff int) *GFPoly

MultByMonominal ...

func (*GFPoly) Multiply

func (gp *GFPoly) Multiply(other *GFPoly) *GFPoly

Multiply ...

func (*GFPoly) Zero

func (gp *GFPoly) Zero() bool

Zero ...

type GaloisField

type GaloisField struct {
	Size    int
	Base    int
	ALogTbl []int
	LogTbl  []int
}

GaloisField encapsulates galois field arithmetics

func NewGaloisField

func NewGaloisField(pp, fieldSize, b int) *GaloisField

NewGaloisField creates a new galois field

func (*GaloisField) AddOrSub

func (gf *GaloisField) AddOrSub(a, b int) int

AddOrSub add or subtract two numbers

func (*GaloisField) Divide

func (gf *GaloisField) Divide(a, b int) int

Divide divides two numbers

func (*GaloisField) Invers

func (gf *GaloisField) Invers(num int) int

Invers ...

func (*GaloisField) Multiply

func (gf *GaloisField) Multiply(a, b int) int

Multiply multiplys two numbers

func (*GaloisField) Zero

func (gf *GaloisField) Zero() *GFPoly

Zero ...

type Metadata

type Metadata struct {
	// the name of the barcode kind
	CodeKind string
	// contains 1 for 1D barcodes or 2 for 2D barcodes
	Dimensions byte
}

Metadata ... Contains some meta information about a barcode

type Offcolor

type Offcolor struct {
	Offset  uint8
	Color   string
	Opacity float64
}

Offcolor defines the offset and color for gradients

type QrSVG

type QrSVG struct {
	// contains filtered or unexported fields
}

QrSVG ...

func NewQrSVG

func NewQrSVG(qr Barcode, blockSize int) QrSVG

NewQrSVG ...

func (*QrSVG) StartQrSVG

func (qs *QrSVG) StartQrSVG(s *SVG)

StartQrSVG ...

func (*QrSVG) WriteQrSVG

func (qs *QrSVG) WriteQrSVG(s *SVG) error

WriteQrSVG ...

type ReedSolomonEncoder

type ReedSolomonEncoder struct {
	// contains filtered or unexported fields
}

ReedSolomonEncoder ...

func NewReedSolomonEncoder

func NewReedSolomonEncoder(gf *GaloisField) *ReedSolomonEncoder

NewReedSolomonEncoder ...

func (*ReedSolomonEncoder) Encode

func (rs *ReedSolomonEncoder) Encode(data []int, eccCount int) []int

Encode ..

type SVG

type SVG struct {
	Writer io.Writer
}

SVG defines the location of the generated SVG

func New

func New(w io.Writer) *SVG

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

func (*SVG) Animate

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

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

func (*SVG) AnimateMotion

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

AnimateMotion animates the referenced object along the specified path

func (*SVG) AnimateRotate

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

AnimateRotate animates the rotation transformation

func (*SVG) AnimateScale

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

AnimateScale animates the scale transformation

func (*SVG) AnimateSkewX

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

AnimateSkewX animates the skewX transformation

func (*SVG) AnimateSkewY

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

AnimateSkewY animates the skewY transformation

func (*SVG) AnimateTransform

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

AnimateTransform animates in the context of SVG transformations

func (*SVG) AnimateTranslate

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

AnimateTranslate animates the translation transformation

func (*SVG) Arc

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

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

func (*SVG) Bezier

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

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

func (*SVG) Blur

func (svg *SVG) Blur(p float64)

Blur emulates the CSS blur filter

func (*SVG) Brightness

func (svg *SVG) Brightness(p float64)

Brightness emulates the CSS brightness filter

func (*SVG) CenterRect

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

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

func (*SVG) Circle

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

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

func (*SVG) ClipEnd

func (svg *SVG) ClipEnd()

ClipEnd ends a ClipPath

func (*SVG) ClipPath

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

ClipPath defines a clip path

func (*SVG) Def

func (svg *SVG) Def()

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

func (*SVG) DefEnd

func (svg *SVG) DefEnd()

DefEnd ends a definition block.

func (*SVG) Desc

func (svg *SVG) Desc(s string)

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

func (*SVG) Ellipse

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

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

func (*SVG) End

func (svg *SVG) End()

End the SVG document

func (*SVG) FeBlend

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

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

func (*SVG) FeColorMatrix

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

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

func (*SVG) FeColorMatrixHue

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

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

func (*SVG) FeColorMatrixLuminence

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

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

func (*SVG) FeColorMatrixSaturate

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

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

func (*SVG) FeCompEnd

func (svg *SVG) FeCompEnd()

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

func (*SVG) FeComponentTransfer

func (svg *SVG) FeComponentTransfer()

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

func (*SVG) FeComposite

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

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

func (*SVG) FeConvolveMatrix

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

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

func (*SVG) FeDiffEnd

func (svg *SVG) FeDiffEnd()

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

func (*SVG) FeDiffuseLighting

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

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

func (*SVG) FeDisplacementMap

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

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

func (*SVG) FeDistantLight

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

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

func (*SVG) FeFlood

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

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

func (*SVG) FeFuncDiscrete

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

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

func (*SVG) FeFuncGamma

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

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

func (*SVG) FeFuncLinear

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

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

func (*SVG) FeFuncTable

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

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

func (*SVG) FeGaussianBlur

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

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

func (*SVG) FeImage

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

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

func (*SVG) FeMerge

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

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

func (*SVG) FeMorphology

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

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

func (*SVG) FeOffset

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

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

func (*SVG) FePointLight

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

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

func (*SVG) FeSpecEnd

func (svg *SVG) FeSpecEnd()

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

func (*SVG) FeSpecularLighting

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

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

func (*SVG) FeSpotLight

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

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

func (*SVG) FeTile

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

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

func (*SVG) FeTurbulence

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

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

func (*SVG) Fend

func (svg *SVG) Fend()

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

func (*SVG) Filter

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

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

func (*SVG) Gend

func (svg *SVG) Gend()

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

func (*SVG) Gid

func (svg *SVG) Gid(s string)

Gid begins a group, with the specified id

func (*SVG) Grayscale

func (svg *SVG) Grayscale()

Grayscale eumulates the CSS grayscale filter

func (*SVG) Grid

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

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

func (*SVG) Group

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

Group begins a group with arbitrary attributes

func (*SVG) Gstyle

func (svg *SVG) Gstyle(s string)

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

func (*SVG) Gtransform

func (svg *SVG) Gtransform(s string)

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

func (*SVG) HueRotate

func (svg *SVG) HueRotate(a float64)

HueRotate eumulates the CSS huerotate filter

func (*SVG) Image

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

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

func (*SVG) Invert

func (svg *SVG) Invert()

Invert eumulates the CSS invert filter

func (*SVG) Line

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

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

func (*SVG) LinearGradient

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

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

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

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

func (*SVG) LinkEnd

func (svg *SVG) LinkEnd()

LinkEnd ends a link.

func (*SVG) Marker

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

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

func (*SVG) MarkerEnd

func (svg *SVG) MarkerEnd()

MarkerEnd ends a marker

func (*SVG) Mask

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

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

func (*SVG) MaskEnd

func (svg *SVG) MaskEnd()

MaskEnd ends a Mask.

func (*SVG) Path

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

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

func (*SVG) Pattern

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

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

func (*SVG) PatternEnd

func (svg *SVG) PatternEnd()

PatternEnd ends a marker

func (*SVG) Polygon

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

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

func (*SVG) Polyline

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

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

func (*SVG) Qbez

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

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

func (*SVG) Qbezier

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

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

func (*SVG) RGB

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

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

func (*SVG) RGBA

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

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

func (*SVG) RadialGradient

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

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

func (*SVG) Rect

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

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

func (*SVG) Rotate

func (svg *SVG) Rotate(r float64)

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

func (*SVG) RotateTranslate

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

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

func (*SVG) Roundrect

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

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

func (*SVG) Saturate

func (svg *SVG) Saturate(p float64)

Saturate eumulates the CSS saturate filter

func (*SVG) Scale

func (svg *SVG) Scale(n float64)

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

func (*SVG) ScaleXY

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

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

func (*SVG) Script

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

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

func (*SVG) Sepia

func (svg *SVG) Sepia()

Sepia applies a sepia tone, emulating the CSS sepia filter

func (*SVG) SkewX

func (svg *SVG) SkewX(a float64)

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

func (*SVG) SkewXY

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

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

func (*SVG) SkewY

func (svg *SVG) SkewY(a float64)

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

func (*SVG) Span

func (svg *SVG) Span(t string, s ...string)

Span makes styled spanned text, should be proceeded by Textspan Standard Reference: https://www.w3.org/TR/SVG11/text.html#TSpanElement

func (*SVG) Square

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

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

func (*SVG) Start

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

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

func (*SVG) Startpercent

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

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

func (*SVG) Startraw

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

Startraw begins the SVG document, passing arbitrary attributes

func (*SVG) Startunit

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

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

func (*SVG) Startview

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

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

func (*SVG) StartviewUnit

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

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

func (*SVG) Style

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

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

func (*SVG) Text

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

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

func (*SVG) TextEnd

func (svg *SVG) TextEnd()

TextEnd ends spanned text Standard Reference: https://www.w3.org/TR/SVG11/text.html#TSpanElement

func (*SVG) Textlines

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

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

func (*SVG) Textpath

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

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

func (*SVG) Textspan

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

Textspan begins text, assuming a tspan will be included, end with TextEnd() Standard Reference: https://www.w3.org/TR/SVG11/text.html#TSpanElement

func (*SVG) Title

func (svg *SVG) Title(s string)

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

func (*SVG) Translate

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

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

func (*SVG) TranslateRotate

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

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

func (*SVG) Use

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL