|
- package path
-
- import (
- "image/color"
-
- "github.com/tdewolff/canvas"
- )
-
- type Style struct {
- Thickness float64
- Color color.RGBA
- Dashes []float64
- }
-
- func (s Style) ToCanvas() canvas.Style {
- return canvas.Style{
- Fill: canvas.Paint{},
- Stroke: canvas.Paint{Color: s.Color},
- StrokeWidth: s.Thickness,
- StrokeCapper: canvas.RoundCap,
- StrokeJoiner: canvas.BevelJoin,
- DashOffset: 0,
- Dashes: s.Dashes,
- FillRule: 0,
- }
- }
-
- func NewDefaultStyle() Style {
- return Style{
- Thickness: 0.2,
- Color: canvas.Black,
- }
- }
|