add mask example
This commit is contained in:
parent
ae49c2a7ae
commit
b28a9453d4
BIN
examples/lenna.png
Normal file
BIN
examples/lenna.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 463 KiB |
20
examples/mask.go
Normal file
20
examples/mask.go
Normal 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")
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user