update readme

This commit is contained in:
Michael Fogleman 2016-12-14 14:51:04 -05:00
parent 65947eb047
commit 62c697d628

View File

@ -52,6 +52,7 @@ Ever used a graphics library that didn't have functions for drawing rectangles
or circles? What a pain! or circles? What a pain!
```go ```go
DrawPoint(x, y, r float64)
DrawLine(x1, y1, x2, y2 float64) DrawLine(x1, y1, x2, y2 float64)
DrawRectangle(x, y, w, h float64) DrawRectangle(x, y, w, h float64)
DrawRoundedRectangle(x, y, w, h, r float64) DrawRoundedRectangle(x, y, w, h, r float64)
@ -62,6 +63,7 @@ DrawEllipticalArc(x, y, rx, ry, angle1, angle2 float64)
DrawRegularPolygon(n int, x, y, r, rotation float64) DrawRegularPolygon(n int, x, y, r, rotation float64)
DrawImage(im image.Image, x, y int) DrawImage(im image.Image, x, y int)
DrawImageAnchored(im image.Image, x, y int, ax, ay float64) DrawImageAnchored(im image.Image, x, y int, ax, ay float64)
SetPixel(x, y int)
MoveTo(x, y float64) MoveTo(x, y float64)
LineTo(x, y float64) LineTo(x, y float64)
@ -117,6 +119,19 @@ SetDash(dashes ...float64)
SetFillRule(fillRule FillRule) SetFillRule(fillRule FillRule)
``` ```
## Gradients & Patterns
`gg` supports linear and radial gradients and surface patterns. You can also implement your own patterns.
```go
SetFillStyle(pattern Pattern)
SetStrokeStyle(pattern Pattern)
NewSolidPattern(color color.Color)
NewLinearGradient(x0, y0, x1, y1 float64)
NewRadialGradient(x0, y0, r0, x1, y1, r1 float64)
NewSurfacePattern(im image.Image, op RepeatOp)
```
## Transformation Functions ## Transformation Functions
```go ```go
@ -174,13 +189,6 @@ SavePNG(path string, im image.Image) error
![Separator](http://i.imgur.com/fsUvnPB.png) ![Separator](http://i.imgur.com/fsUvnPB.png)
## What's Missing?
If you need any of the features below, I recommend using `cairo` instead. Or
even better, implement it and submit a pull request!
- Gradients / Patterns
## How Do it Do? ## How Do it Do?
`gg` is mostly a wrapper around `github.com/golang/freetype/raster`. The goal `gg` is mostly a wrapper around `github.com/golang/freetype/raster`. The goal