add mask example

This commit is contained in:
Michael Fogleman 2016-09-28 10:25:10 -04:00
parent ae49c2a7ae
commit b28a9453d4
2 changed files with 20 additions and 0 deletions

BIN
examples/lenna.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 KiB

20
examples/mask.go Normal file
View File

@ -0,0 +1,20 @@
package main
import (
"log"
"github.com/fogleman/gg"
)
func main() {
im, err := gg.LoadImage("examples/lenna.png")
if err != nil {
log.Fatal(err)
}
dc := gg.NewContext(512, 512)
dc.DrawRoundedRectangle(0, 0, 512, 512, 64)
dc.Clip()
dc.DrawImage(im, 0, 0)
dc.SavePNG("out.png")
}