SetStroke sets the stroke style in plot paint to current line style. returns false if either the Width = 0 or Color is nil
(pt *Plot)
| 34 | // SetStroke sets the stroke style in plot paint to current line style. |
| 35 | // returns false if either the Width = 0 or Color is nil |
| 36 | func (ls *LineStyle) SetStroke(pt *Plot) bool { |
| 37 | if ls.Color == nil { |
| 38 | return false |
| 39 | } |
| 40 | pc := pt.Paint |
| 41 | uc := &pc.UnitContext |
| 42 | ls.Width.ToDots(uc) |
| 43 | if ls.Width.Dots == 0 { |
| 44 | return false |
| 45 | } |
| 46 | pc.StrokeStyle.Width = ls.Width |
| 47 | pc.StrokeStyle.Color = ls.Color |
| 48 | pc.StrokeStyle.ToDots(uc) |
| 49 | return true |
| 50 | } |
| 51 | |
| 52 | // Draw draws a line between given coordinates, setting the stroke style |
| 53 | // to current parameters. Returns false if either Width = 0 or Color = nil |