Documentation ¶
Overview ¶
Package gfx contains drawing utilities for a draw.Image destination.
Index ¶
- type Context
- func (ctx *Context) Clear()
- func (ctx *Context) DrawLine(x0, y0, x1, y1 int)
- func (ctx *Context) DrawString(s string, x, y int)
- func (ctx *Context) FillCircle(x0, y0, rad int)
- func (ctx *Context) HLine(x1, x2, y int)
- func (ctx *Context) Point(x, y int)
- func (ctx *Context) Rectangle(x1, y1, width, height int)
- func (ctx *Context) SetColor(col color.Color)
- func (ctx *Context) SetColorRGBA(r, g, b, a byte)
- func (ctx *Context) VLine(y1, y2, x int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context provides primitive drawing operations on a draw.Image. All operations use the drawing color set by SetColor().
func NewContext ¶
NewContext returns a new Context initialized with black drawing color.
func (*Context) DrawLine ¶
DrawLine draws a line. The Bresenham's line algorithm is used which is detailed here: https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
func (*Context) DrawString ¶
DrawString draws a string. The y coordinate is the bottom line of the text.
func (*Context) FillCircle ¶
FillCircle draws a filled circle. The Midpoint circle algorithm is used which is detailed here: https://en.wikipedia.org/wiki/Midpoint_circle_algorithm
func (*Context) SetColorRGBA ¶
SetColorRGBA sets the drawing color.