Update README.md
This commit is contained in:
parent
10f97432c4
commit
17e9e8cd2b
12
README.md
12
README.md
@ -8,25 +8,19 @@
|
|||||||
|
|
||||||
## Hello, Circle!
|
## Hello, Circle!
|
||||||
|
|
||||||
|
Look how easy!
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/fogleman/gg"
|
import "github.com/fogleman/gg"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// create a new 1000x1000 pixel image
|
|
||||||
dc := gg.NewContext(1000, 1000)
|
dc := gg.NewContext(1000, 1000)
|
||||||
|
|
||||||
// draw a circle at the center with radius 400
|
|
||||||
// nothing is drawn yet, we have to call Stroke or Fill
|
|
||||||
dc.DrawCircle(500, 500, 400)
|
dc.DrawCircle(500, 500, 400)
|
||||||
|
|
||||||
// use black and 10px stroke width
|
|
||||||
dc.SetRGB(0, 0, 0)
|
dc.SetRGB(0, 0, 0)
|
||||||
dc.SetLineWidth(10)
|
dc.SetLineWidth(10)
|
||||||
dc.Stroke()
|
dc.Stroke()
|
||||||
|
|
||||||
// write the result to file
|
|
||||||
dc.SavePNG("out.png")
|
dc.SavePNG("out.png")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -74,6 +68,8 @@ SetRGB(r, g, b float64)
|
|||||||
|
|
||||||
## Transformation Functions
|
## Transformation Functions
|
||||||
|
|
||||||
|
All the usual matrix transformations are available too.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
Identity()
|
Identity()
|
||||||
Translate(x, y float64)
|
Translate(x, y float64)
|
||||||
|
Loading…
Reference in New Issue
Block a user