1// Copyright 2017 The oksvg Authors. All rights reserved.
2// created: 2/12/2017 by S.R.Wiley
3//
4// utils.go implements translation of an SVG2.0 path into a rasterx Path.
5
6package oksvg
7
8import (
9 "image/color"
10
11 "github.com/srwiley/rasterx"
12)
13
14// PathStyle holds the state of the SVG style.
15type PathStyle struct {
16 FillOpacity, LineOpacity float64
17 LineWidth, DashOffset, MiterLimit float64
18 Dash []float64
19 UseNonZeroWinding bool
20 fillerColor, linerColor interface{} // either color.Color or rasterx.Gradient
21 LineGap rasterx.GapFunc
22 LeadLineCap rasterx.CapFunc // This is used if different than LineCap
23 LineCap rasterx.CapFunc
24 LineJoin rasterx.JoinMode
25 mAdder rasterx.MatrixAdder // current transform
26}
27
28// styleAttribute describes draw options, such as {"fill":"black"; "stroke":"white"}.
29type styleAttribute = map[string]string
30
31// DefaultStyle sets the default PathStyle to fill black, winding rule,
32// full opacity, no stroke, ButtCap line end and Bevel line connect.
33var DefaultStyle = PathStyle{1.0, 1.0, 2.0, 0.0, 4.0, nil, true,
34 color.NRGBA{0x00, 0x00, 0x00, 0xff}, nil,
35 nil, nil, rasterx.ButtCap, rasterx.Bevel, rasterx.MatrixAdder{M: rasterx.Identity}}