Thumbnail returns the thumbnail for the Line, implementing the plot.Thumbnailer interface.
(c *draw.Canvas)
| 172 | |
| 173 | // Thumbnail returns the thumbnail for the Line, implementing the plot.Thumbnailer interface. |
| 174 | func (pts *Line) Thumbnail(c *draw.Canvas) { |
| 175 | if pts.FillColor != nil { |
| 176 | var topY vg.Length |
| 177 | if pts.LineStyle.Width == 0 { |
| 178 | topY = c.Max.Y |
| 179 | } else { |
| 180 | topY = (c.Min.Y + c.Max.Y) / 2 |
| 181 | } |
| 182 | points := []vg.Point{ |
| 183 | {X: c.Min.X, Y: c.Min.Y}, |
| 184 | {X: c.Min.X, Y: topY}, |
| 185 | {X: c.Max.X, Y: topY}, |
| 186 | {X: c.Max.X, Y: c.Min.Y}, |
| 187 | } |
| 188 | poly := c.ClipPolygonY(points) |
| 189 | c.FillPolygon(pts.FillColor, poly) |
| 190 | } |
| 191 | |
| 192 | if pts.LineStyle.Width != 0 { |
| 193 | y := c.Center().Y |
| 194 | c.StrokeLine2(pts.LineStyle, c.Min.X, y, c.Max.X, y) |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | // NewLinePoints returns both a Line and a |
| 199 | // Points for the given point data. |
nothing calls this directly
no test coverage detected