25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
560B

  1. package path
  2. import (
  3. "image/color"
  4. "github.com/tdewolff/canvas"
  5. )
  6. type Style struct {
  7. Thickness float64
  8. Color color.RGBA
  9. Dashes []float64
  10. }
  11. func (s Style) ToCanvas() canvas.Style {
  12. return canvas.Style{
  13. Fill: canvas.Paint{},
  14. Stroke: canvas.Paint{Color: s.Color},
  15. StrokeWidth: s.Thickness,
  16. StrokeCapper: canvas.RoundCap,
  17. StrokeJoiner: canvas.BevelJoin,
  18. DashOffset: 0,
  19. Dashes: s.Dashes,
  20. FillRule: 0,
  21. }
  22. }
  23. func NewDefaultStyle() Style {
  24. return Style{
  25. Thickness: 0.2,
  26. Color: canvas.Black,
  27. }
  28. }