Documentation ¶
Index ¶
- Variables
- func Rad2Deg(rad float64) float64
- type BasicProperties
- type Circle
- type Draw
- func (d *Draw) DrawCircle(c Circle)
- func (d *Draw) DrawLegend(l *Legend)
- func (d *Draw) DrawOnEdge(c Circle, angle float64, sides int, radius float64, props BasicProperties)
- func (d *Draw) DrawRegularPolygon(sides int, x, y, radius float64, props BasicProperties)
- func (d *Draw) WriteBoldStringAt(text string, x, y float64) (width float64)
- func (d *Draw) WriteStringAt(text string, x, y float64) (width float64)
- type Legend
- type LegendElement
Constants ¶
This section is empty.
Variables ¶
var Black = color.RGBA{0, 0, 0, 255}
Black is a sensible default RGB color choice
var Blue = color.RGBA{51, 147, 204, 255}
Blue is a sensible default RGB color choice
var DefaultBasicProperties = BasicProperties{ Color: White, Stroke: Black, Weight: 1, }
DefaultBasicProperties provides sensible defaults for shape properties
var Green = color.RGBA{62, 214, 89, 255}
Green is a sensible default RGB color choice
var Orange = color.RGBA{234, 133, 44, 255}
Orange is a sensible default RGB color choice
Pallate is a collection of preset colors for easy cycling through in list iterations
var Purple = color.RGBA{175, 102, 209, 255}
Purple is a sensible default RGB color choice
var Red = color.RGBA{244, 86, 66, 255}
Red is a sensible default RGB color choice
var White = color.RGBA{255, 255, 255, 255}
White is a sensible default RGB color choice
var Yellow = color.RGBA{239, 235, 117, 255}
Yellow is a sensible default RGB color choice
Functions ¶
Types ¶
type BasicProperties ¶
BasicProperties contains the basic properties that all shapes need
type Circle ¶
type Circle struct { Props BasicProperties X, Y, Radius float64 }
Circle is a simple struct with circle's properties
type Draw ¶
type Draw struct {
*draw2dimg.GraphicContext
}
Draw embeds draw2dimg.GraphicContext and gives us some handy simple drawing tools
func (*Draw) DrawLegend ¶
DrawLegend draws out the legend and all its registered elements
func (*Draw) DrawOnEdge ¶
func (d *Draw) DrawOnEdge(c Circle, angle float64, sides int, radius float64, props BasicProperties)
DrawOnEdge will draw a regular poloygon on the circumference of a given circle
func (*Draw) DrawRegularPolygon ¶
func (d *Draw) DrawRegularPolygon(sides int, x, y, radius float64, props BasicProperties)
DrawRegularPolygon draws a regular polygon, but handles special case of also drawing a circle if sides <= 1. Could add wrappers for DrawSquare or DrawTriangle if warrented. Not needed currently.
func (*Draw) WriteBoldStringAt ¶
WriteBoldStringAt writes bold black text at the given location
type Legend ¶
type Legend struct { Title string Caption string Elements []LegendElement }
Legend is used for displaying a legend, as for a chart
func (*Legend) AppendElement ¶
func (l *Legend) AppendElement(polygonSides int, name string, props BasicProperties)
AppendElement is a helper to cut down on visual clutter when developing. Not async.
func (*Legend) ContentHeight ¶
ContentHeight returns the height of the computed legend
func (*Legend) ContentWidth ¶
ContentWidth returns the width of the computed legend
func (*Legend) PrependElement ¶
func (l *Legend) PrependElement(polygonSides int, name string, props BasicProperties)
PrependElement is a helper to cut down on visual clutter when developing. Not async.
type LegendElement ¶
type LegendElement struct { Name string PolygonSides int Width, Height float64 Props BasicProperties }
LegendElement is used in the Legend struct and is not likely to be used outside the package. It is exported just in case it it needed.