MCPcopy Create free account
hub / github.com/cogentcore/core / SetStroke

Method SetStroke

plot/line.go:36–50  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
36func (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

Callers 9

DrawMethod · 0.95
PlotMethod · 0.45
ThumbnailMethod · 0.45
PlotMethod · 0.45
ThumbnailMethod · 0.45
PlotMethod · 0.45
ThumbnailMethod · 0.45
PlotMethod · 0.45
PlotMethod · 0.45

Calls 1

ToDotsMethod · 0.45

Tested by

no test coverage detected