MCPcopy Index your code
hub / github.com/gonum/plot / Thumbnail

Method Thumbnail

plotter/polygon.go:113–130  ·  view source on GitHub ↗

Thumbnail creates the thumbnail for the Polygon, implementing the plot.Thumbnailer interface.

(c *draw.Canvas)

Source from the content-addressed store, hash-verified

111// Thumbnail creates the thumbnail for the Polygon,
112// implementing the plot.Thumbnailer interface.
113func (pts *Polygon) Thumbnail(c *draw.Canvas) {
114 if pts.Color != nil {
115 points := []vg.Point{
116 {X: c.Min.X, Y: c.Min.Y},
117 {X: c.Min.X, Y: c.Max.Y},
118 {X: c.Max.X, Y: c.Max.Y},
119 {X: c.Max.X, Y: c.Min.Y},
120 }
121 poly := c.ClipPolygonY(points)
122 c.FillPolygon(pts.Color, poly)
123
124 points = append(points, vg.Point{X: c.Min.X, Y: c.Min.Y})
125 c.StrokeLines(pts.LineStyle, points)
126 } else {
127 y := c.Center().Y
128 c.StrokeLine2(pts.LineStyle, c.Min.X, y, c.Max.X, y)
129 }
130}

Callers

nothing calls this directly

Calls 5

ClipPolygonYMethod · 0.80
FillPolygonMethod · 0.80
StrokeLinesMethod · 0.80
CenterMethod · 0.80
StrokeLine2Method · 0.80

Tested by

no test coverage detected