Documentation
¶
Index ¶
- Variables
- func LogDuration(operation string, taken time.Duration)
- func NoDurationLog(operation string, taken time.Duration)
- type Point
- type Polygon
- type Rect
- type Surface
- func (s *Surface) Circle(centreX, centreY, radius int, c color.RGBA)
- func (s *Surface) Clear(c color.RGBA)
- func (s *Surface) DrawPolygon(polygon Polygon, c color.RGBA)
- func (s *Surface) DrawPolygonA(polygon Polygon, c color.RGBA)
- func (s *Surface) DrawRect(rect Rect, c color.RGBA)
- func (s *Surface) FillCircle(centreX, centreY, radius int, c color.RGBA)
- func (s *Surface) FillRect(rect Rect, c color.RGBA)
- func (s *Surface) GetColorGradient(start, end color.RGBA) [101]color.RGBA
- func (s *Surface) GetPoint(x, y int) color.RGBA
- func (s *Surface) GetWeightedColor(c1, c2 color.RGBA, weight float64) color.RGBA
- func (s *Surface) Hline(start, end Point, c color.RGBA)
- func (s *Surface) Line(start, end Point, c color.RGBA)
- func (s *Surface) LineA(start, end Point, c color.RGBA)
- func (s *Surface) Plot(x, y int, c color.RGBA)
- func (s *Surface) PlotA(x1, y1, x2, y2 float64, c color.RGBA, weight float64)
- func (s *Surface) PlotPoint(point Point, c color.RGBA)
- func (s *Surface) Vline(start, end Point, c color.RGBA)
- func (s *Surface) WritePNG(w io.Writer) error
- type TimingLogFunc
Constants ¶
This section is empty.
Variables ¶
var ( // Transparent ... Fully transparent. Transparent = color.RGBA{R: 0, G: 0, B: 0, A: 0} // Black ... Returns opaque Black as RGBA. Black = color.RGBA{R: 0, G: 0, B: 0, A: 255} // Blue ... Returns opaque Blue as RGBA. Blue = color.RGBA{R: 32, G: 0, B: 192, A: 255} // Red ... Returns opaque Red as RGBA. Red = color.RGBA{R: 176, G: 0, B: 0, A: 255} // Magenta ... Returns opaque Magenta as RGBA. Magenta = color.RGBA{R: 192, G: 0, B: 176, A: 255} // Green ... Returns opaque Green as RGBA. Green = color.RGBA{R: 0, G: 176, B: 16, A: 255} // Cyan ... Returns opaque Cyan as RGBA. Cyan = color.RGBA{R: 0, G: 176, B: 176, A: 255} // Yellow ... Returns opaque Yellow as RGBA. Yellow = color.RGBA{R: 176, G: 176, B: 0, A: 255} // Gray ... Returns opaque Gray as RGBA. Gray = color.RGBA{R: 176, G: 176, B: 176, A: 255} // LightBlue ... Returns opaque LightBlue as RGBA. LightBlue = color.RGBA{R: 64, G: 0, B: 255, A: 255} // LightRed ... Returns opaque LightRed as RGBA. LightRed = color.RGBA{R: 255, G: 0, B: 0, A: 255} // LightMagenta ... Returns opaque LightMagenta as RGBA. LightMagenta = color.RGBA{R: 255, G: 0, B: 255, A: 255} // LightGreen ... Returns opaque LightGreen as RGBA. LightGreen = color.RGBA{R: 0, G: 255, B: 32, A: 255} // LightCyan ... Returns opaque LightCyan as RGBA. LightCyan = color.RGBA{R: 0, G: 255, B: 255, A: 255} // LightYellow ... Returns opaque LightYellow as RGBA. LightYellow = color.RGBA{R: 255, G: 255, B: 0, A: 255} // White ... Returns opaque White as RGBA. White = color.RGBA{R: 255, G: 255, B: 255, A: 255} )
Functions ¶
func LogDuration ¶
LogDuration ... Sample duration logger that uses the standard logger.
func NoDurationLog ¶
NoDurationLog ... Sample duration logger that does nothing.
Types ¶
type Polygon ¶
type Polygon []Point
Polygon ... Defines an auto-closing shape.
func NewPolygon ¶
NewPolygon ... Returns a new polygon with the given points.
type Surface ¶
type Surface struct { Image *image.RGBA Bounds Rect Width, Height int Background color.RGBA // contains filtered or unexported fields }
Surface ... Drawing surface with various primitives and helpers.
func NewSurface ¶
func NewSurface(width, height int, logger TimingLogFunc) Surface
NewSurface ... Returns a new drawing surface.
func (*Surface) DrawPolygon ¶
DrawPolygon ... Draws a polygon, joining the end point back to the start.
func (*Surface) DrawPolygonA ¶
DrawPolygonA ... Draws an antialiased polygon, joining the end point back to the start.
func (*Surface) FillCircle ¶
FillCircle ... Draws a filled circle.
func (*Surface) GetColorGradient ¶
GetColorGradient ... Returns colors mapped by integer percentage from start to end.
func (*Surface) GetWeightedColor ¶
GetWeightedColor ... Calculate weighted (0..100) color moving from c1 to c2.
func (*Surface) LineA ¶
LineA ... Draws an arbitrary naive antialiased line (Xiaolin Wu's algorithm).
type TimingLogFunc ¶
TimingLogFunc ... Logs timings. Sample LogDuration and NoDurationLog implementations are provided.