Documentation
¶
Overview ¶
This package converts a SVG file into a coressponding SST 2D geometry representation.
Index ¶
- Variables
- func CombineTransforms(parentTransform, childTransform string) string
- func ConverSvgToGraph(svgContent string, id uuid.UUID) (sst.NamedGraph, error)
- func ConvertSVGFromText(svgContent, baseName, outputDir string) error
- func GetArcCenterPoint(arc EllipticalArc) (float64, float64)
- func Transform()
- type Circle
- type CubicBezier
- type Ellipse
- type EllipticalArc
- type Group
- type Line
- type Matrix
- type Path
- type PathCommand
- type Point
- type Polygon
- type Polyline
- type QuadraticBezier
- type Rect
- type SVG
- type Shape
- type ShapeStyle
- type StyledShape
- type Text
Constants ¶
This section is empty.
Variables ¶
View Source
var IdentityMatrix = Matrix{
{1, 0, 0},
{0, 1, 0},
{0, 0, 1},
}
Identity matrix
Functions ¶
func CombineTransforms ¶
func ConverSvgToGraph ¶
func ConvertSVGFromText ¶
func GetArcCenterPoint ¶
func GetArcCenterPoint(arc EllipticalArc) (float64, float64)
Types ¶
type Circle ¶
type Circle struct {
CX float64 `xml:"cx,attr"`
CY float64 `xml:"cy,attr"`
Radius float64 `xml:"r,attr"`
ShapeStyle
Transform string `xml:"transform,attr,omitempty"`
Direction float64
}
func (Circle) GetDirection ¶
func (Circle) GetStyle ¶
func (c Circle) GetStyle() ShapeStyle
type CubicBezier ¶
type Ellipse ¶
type Ellipse struct {
CX float64 `xml:"cx,attr"`
CY float64 `xml:"cy,attr"`
RX float64 `xml:"rx,attr"`
RY float64 `xml:"ry,attr"`
ShapeStyle
Transform string `xml:"transform,attr,omitempty"`
Direction float64
}
func (Ellipse) GetDirection ¶
func (Ellipse) GetStyle ¶
func (e Ellipse) GetStyle() ShapeStyle
type EllipticalArc ¶
type Group ¶
type Group struct {
XMLName xml.Name `xml:"g"`
Style string `xml:"style,attr,omitempty"`
ShapeStyle
Transform string `xml:"transform,attr,omitempty"`
Rects []Rect `xml:"rect"`
Texts []Text `xml:"text"`
Circles []Circle `xml:"circle"`
Ellipses []Ellipse `xml:"ellipse"`
Lines []Line `xml:"line"`
Paths []Path `xml:"path"`
Polygons []Polygon `xml:"polygon"`
Polylines []Polyline `xml:"polyline"`
Groups []Group `xml:"g"`
}
type Line ¶
type Line struct {
XMLName xml.Name `xml:"line"`
X1 float64 `xml:"x1,attr"`
Y1 float64 `xml:"y1,attr"`
X2 float64 `xml:"x2,attr"`
Y2 float64 `xml:"y2,attr"`
ShapeStyle
Transform string `xml:"transform,attr,omitempty"`
Direction float64
}
func (Line) GetDirection ¶
func (Line) GetStyle ¶
func (l Line) GetStyle() ShapeStyle
type Matrix ¶
type Matrix [3][3]float64
func MatrixTransform ¶
MatrixTransform creates a transformation matrix from matrix(a, b, c, d, e, f) parameters.
func ParseTransform ¶
Parse the transform attribute and generate a transformation matrix
func RotateMatrix ¶
func TranslateMatrix ¶
Translation transformation matrix
type Path ¶
type Path struct {
XMLName xml.Name `xml:"path"`
D string `xml:"d,attr"`
ShapeStyle
Transform string `xml:"transform,attr,omitempty"`
Direction float64
}
func (Path) GetDirection ¶
func (Path) GetStyle ¶
func (p Path) GetStyle() ShapeStyle
type PathCommand ¶
type Polygon ¶
type Polygon struct {
XMLName xml.Name `xml:"polygon"`
Points string `xml:"points,attr"`
ShapeStyle
Transform string `xml:"transform,attr,omitempty"`
Direction float64
}
func (Polygon) GetDirection ¶
func (Polygon) GetStyle ¶
func (p Polygon) GetStyle() ShapeStyle
type Polyline ¶
type Polyline struct {
XMLName xml.Name `xml:"polyline"`
Points string `xml:"points,attr"`
ShapeStyle
Transform string `xml:"transform,attr,omitempty"`
Direction float64
}
func (Polyline) GetDirection ¶
func (Polyline) GetStyle ¶
func (p Polyline) GetStyle() ShapeStyle
type QuadraticBezier ¶
type Rect ¶
type Rect struct {
XMLName xml.Name `xml:"rect"`
Style string `xml:"style,attr"`
XLength float64 `xml:"width,attr"`
YLength float64 `xml:"height,attr"`
X float64 `xml:"x,attr"`
Y float64 `xml:"y,attr"`
RX float64 `xml:"rx,attr"`
RY float64 `xml:"ry,attr"`
ShapeStyle
Transform string `xml:"transform,attr,omitempty"`
Direction float64
}
func (Rect) GetDirection ¶
func (Rect) GetStyle ¶
func (r Rect) GetStyle() ShapeStyle
type SVG ¶
type SVG struct {
XMLName xml.Name `xml:"svg"`
Width string `xml:"width,attr"`
Height string `xml:"height,attr"`
ViewBox string `xml:"viewBox,attr"`
XMLNS string `xml:"xmlns,attr"`
Version string `xml:"version,attr"`
Title string `xml:"title"`
Desc string `xml:"desc"`
Rects []Rect `xml:"rect"`
Texts []Text `xml:"text"`
Circles []Circle `xml:"circle"`
Ellipses []Ellipse `xml:"ellipse"`
Lines []Line `xml:"line"`
Paths []Path `xml:"path"`
Polygons []Polygon `xml:"polygon"`
Polylines []Polyline `xml:"polyline"`
Groups []Group `xml:"g"`
}
type Shape ¶
type Shape interface {
GetStyle() ShapeStyle
GetType() string
GetDirection() float64
}
func TransformShape ¶
type ShapeStyle ¶
type ShapeStyle struct {
Fill string `xml:"fill,attr"`
Stroke string `xml:"stroke,attr"`
StrokeWidth string `xml:"stroke-width,attr"`
}
func CombineShapeStyles ¶
func CombineShapeStyles(parentStyle, currentStyle ShapeStyle) ShapeStyle
type StyledShape ¶
type StyledShape interface {
Shape
}
type Text ¶
type Text struct {
XMLName xml.Name `xml:"text"`
Style string `xml:"style,attr"`
X float64 `xml:"x,attr"`
Y float64 `xml:"y,attr"`
Content string `xml:",chardata"`
FontFamily string `xml:"font-family,attr,omitempty"`
FontSize float64 `xml:"font-size,attr,omitempty"`
FontStyle string `xml:"font-style,attr,omitempty"`
FontWeight string `xml:"font-weight,attr,omitempty"`
TextDecoration string `xml:"text-decoration,attr,omitempty"`
ShapeStyle
Transform string `xml:"transform,attr,omitempty"`
Direction float64
}
func (Text) GetDirection ¶
func (Text) GetStyle ¶
func (t Text) GetStyle() ShapeStyle
Click to show internal directories.
Click to hide internal directories.