func (dc *Context) SetRGBA(r, g, b, a float64) {
	dc.color = color.NRGBA{
		uint8(r * 255),
		uint8(g * 255),
		uint8(b * 255),
		uint8(a * 255),
	}
	dc.setFillAndStrokeColor(dc.color)
}
SetRGBA sets the current color. r, g, b, a values should be between 0 and 1,
inclusive.
package gg
import (
	"errors"
	"image"
	"image/color"
	"image/png"
	"io"
	"math"
	"strings"
	"github.com/golang/freetype/raster"
	"golang.org/x/image/draw"
	"golang.org/x/image/font"
	"golang.org/x/image/font/basicfont"
	"golang.org/x/image/math/f64"
)
type LineCap int
const (
	LineCapRound LineCap = iota
	LineCapButt
	LineCapSquare
)
type LineJoin int
const (
	LineJoinRound LineJoin = iota
	LineJoinBevel
)
type FillRule int
const (
	FillRuleWinding FillRule = iota
	FillRuleEvenOdd
)
type Align int
const (
	AlignLeft Align = iota
	AlignCenter
	AlignRight
)
var (
	defaultFillStyle   = NewSolidPattern(color.White)
	defaultStrokeStyle = NewSolidPattern(color.Black)
)
type Context struct {
	width         int
	height        int
	rasterizer    *raster.Rasterizer
	im            *image.RGBA
	mask          *image.Alpha
	color         color.Color
	fillPattern   Pattern
	strokePattern Pattern
	strokePath    raster.Path
	fillPath      raster.Path
	start         Point
	current       Point
	hasCurrent    bool
	dashes        []float64
	dashOffset    float64
	lineWidth     float64
	lineCap       LineCap
	lineJoin      LineJoin
	fillRule      FillRule
	fontFace      font.Face
	fontHeight    float64
	matrix        Matrix
	stack         []*Context
}
func NewContext(width, height int) *Context {
	return NewContextForRGBA(image.NewRGBA(image.Rect(0, 0, width, height)))
}
func NewContextForImage(im image.Image) *Context {
	return NewContextForRGBA(imageToRGBA(im))
}
func NewContextForRGBA(im *image.RGBA) *Context {
	w := im.Bounds().Size().X
	h := im.Bounds().Size().Y
	return &Context{
		width:         w,
		height:        h,
		rasterizer:    raster.NewRasterizer(w, h),
		im:            im,
		color:         color.Transparent,
		fillPattern:   defaultFillStyle,
		strokePattern: defaultStrokeStyle,
		lineWidth:     1,
		fillRule:      FillRuleWinding,
		fontFace:      basicfont.Face7x13,
		fontHeight:    13,
		matrix:        Identity(),
	}
}
func (dc *Context) GetCurrentPoint() (Point, bool) {
	if dc.hasCurrent {
		return dc.current, true
	}
	return Point{}, false
}
func (dc *Context) Image() image.Image {
	return dc.im
}
func (dc *Context) Width() int {
	return dc.width
}
func (dc *Context) Height() int {
	return dc.height
}
func (dc *Context) SavePNG(path string) error {
	return SavePNG(path, dc.im)
}
func (dc *Context) EncodePNG(w io.Writer) error {
	return png.Encode(w, dc.im)
}
func (dc *Context) SetDash(dashes ...float64) {
	dc.dashes = dashes
}
func (dc *Context) SetDashOffset(offset float64) {
	dc.dashOffset = offset
}
func (dc *Context) SetLineWidth(lineWidth float64) {
	dc.lineWidth = lineWidth
}
func (dc *Context) SetLineCap(lineCap LineCap) {
	dc.lineCap = lineCap
}
func (dc *Context) SetLineCapRound() {
	dc.lineCap = LineCapRound
}
func (dc *Context) SetLineCapButt() {
	dc.lineCap = LineCapButt
}
func (dc *Context) SetLineCapSquare() {
	dc.lineCap = LineCapSquare
}
func (dc *Context) SetLineJoin(lineJoin LineJoin) {
	dc.lineJoin = lineJoin
}
func (dc *Context) SetLineJoinRound() {
	dc.lineJoin = LineJoinRound
}
func (dc *Context) SetLineJoinBevel() {
	dc.lineJoin = LineJoinBevel
}
func (dc *Context) SetFillRule(fillRule FillRule) {
	dc.fillRule = fillRule
}
func (dc *Context) SetFillRuleWinding() {
	dc.fillRule = FillRuleWinding
}
func (dc *Context) SetFillRuleEvenOdd() {
	dc.fillRule = FillRuleEvenOdd
}
func (dc *Context) setFillAndStrokeColor(c color.Color) {
	dc.color = c
	dc.fillPattern = NewSolidPattern(c)
	dc.strokePattern = NewSolidPattern(c)
}
func (dc *Context) SetFillStyle(pattern Pattern) {
	if fillStyle, ok := pattern.(*solidPattern); ok {
		dc.color = fillStyle.color
	}
	dc.fillPattern = pattern
}
func (dc *Context) SetStrokeStyle(pattern Pattern) {
	dc.strokePattern = pattern
}
func (dc *Context) SetColor(c color.Color) {
	dc.setFillAndStrokeColor(c)
}
func (dc *Context) SetHexColor(x string) {
	r, g, b, a := parseHexColor(x)
	dc.SetRGBA255(r, g, b, a)
}
func (dc *Context) SetRGBA255(r, g, b, a int) {
	dc.color = color.NRGBA{uint8(r), uint8(g), uint8(b), uint8(a)}
	dc.setFillAndStrokeColor(dc.color)
}
func (dc *Context) SetRGB255(r, g, b int) {
	dc.SetRGBA255(r, g, b, 255)
}