From 0585b0af8cbcccda8e26ff55aa401b66105d7398 Mon Sep 17 00:00:00 2001 From: faiface <faiface@ksp.sk> Date: Wed, 22 Mar 2017 18:53:25 +0100 Subject: [PATCH] improve imdraw doc --- imdraw/imdraw.go | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/imdraw/imdraw.go b/imdraw/imdraw.go index 321c766..fbef4e9 100644 --- a/imdraw/imdraw.go +++ b/imdraw/imdraw.go @@ -26,6 +26,22 @@ import ( // imd.Color(pixel.NRGBA{R: 1, G: 0, B: 0, A: 1}) // imd.Push(pixel.V(200, 200)) // imd.Circle(400, 0) +// +// Here is the list of all available point properties (need to be set before Pushing a point): +// - Color - applies to all +// - Picture - coordinates, only applies to filled polygons +// - Intensity - picture intensity, only applies to filled polygons +// - Precision - curve drawing precision, only applies to circles and ellipses +// - EndShape - shape of the end of a line, only applies to lines and outlines +// +// And here's the list of all shapes that can be drawn (all, except for line, can be filled or +// outlined): +// - Line +// - Polygon +// - Circle +// - Circle arc +// - Ellipse +// - Ellipse arc type IMDraw struct { points []point opts point @@ -158,6 +174,11 @@ func (imd *IMDraw) MakePicture(p pixel.Picture) pixel.TargetPicture { return imd.batch.MakePicture(p) } +// Line draws a polyline of the specified thickness between the Pushed points. +func (imd *IMDraw) Line(thickness float64) { + imd.polyline(thickness, false) +} + // Polygon draws a polygon from the Pushed points. If the thickness is 0, the convex polygon will be // filled. Otherwise, an outline of the specified thickness will be drawn. The outline does not have // to be convex. @@ -226,11 +247,6 @@ func (imd *IMDraw) EllipseArc(radius pixel.Vec, low, high, thickness float64) { } } -// Line draws a polyline of the specified thickness between the Pushed points. -func (imd *IMDraw) Line(thickness float64) { - imd.polyline(thickness, false) -} - func (imd *IMDraw) getAndClearPoints() []point { points := imd.points imd.points = nil -- GitLab