Minor changes

This commit is contained in:
Drahoslav 2017-12-27 12:32:23 +01:00
parent 3af25f5588
commit 6f03f106f6
3 changed files with 10 additions and 16 deletions

View File

@ -2,10 +2,10 @@
// created: 16/12/2017 by Drahoslav Bednář // created: 16/12/2017 by Drahoslav Bednář
// Package draw2svg provides a graphic context that can draw // Package draw2svg provides a graphic context that can draw
// vector graphics and text on svg file using the svgo package. // vector graphics and text on svg file.
// //
// Quick Start // Quick Start
// The following Go code geneartes a simple drawing and saves it // The following Go code geneartes a simple drawing and saves it
// to a svg document: // to a svg document:
// // TODO // TODO
package draw2dsvg package draw2dsvg

View File

@ -11,10 +11,6 @@ import (
"strings" "strings"
) )
const ()
var ()
type drawType int type drawType int
const ( const (
@ -22,15 +18,6 @@ const (
stroked stroked
) )
type SVG bytes.Buffer
func NewSvg() *Svg {
return &Svg{
Xmlns: "http://www.w3.org/2000/svg",
FillStroke: FillStroke{Fill: "none", Stroke: "none"},
}
}
// GraphicContext implements the draw2d.GraphicContext interface // GraphicContext implements the draw2d.GraphicContext interface
// It provides draw2d with a svg backend // It provides draw2d with a svg backend
type GraphicContext struct { type GraphicContext struct {
@ -210,5 +197,5 @@ func (gc *GraphicContext) GetStringBounds(s string) (left, top, right, bottom fl
// CreateStringPath creates a path from the string s at x, y // CreateStringPath creates a path from the string s at x, y
func (gc *GraphicContext) CreateStringPath(text string, x, y float64) (cursor float64) { func (gc *GraphicContext) CreateStringPath(text string, x, y float64) (cursor float64) {
return 0 return 0 // TODO use glyphCache for creating string path
} }

View File

@ -16,6 +16,13 @@ type Svg struct {
FillStroke FillStroke
} }
func NewSvg() *Svg {
return &Svg{
Xmlns: "http://www.w3.org/2000/svg",
FillStroke: FillStroke{Fill: "none", Stroke: "none"},
}
}
type Group struct { type Group struct {
FillStroke FillStroke
Transform string `xml:"transform,attr,omitempty"` Transform string `xml:"transform,attr,omitempty"`