Skip to content

Commit

Permalink
Fixed some more issues
Browse files Browse the repository at this point in the history
  • Loading branch information
scrouthtv authored Mar 6, 2021
1 parent 82ae7ab commit 9ad7f79
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,31 @@ Using the image backend
The following Go code draws the android sample on a png image:

```
import (
"image"
package main
"github.com/llgcode/draw2d"
"github.com/llgcode/draw2d/samples/android"
)
import "log"
import "image"
import "github.com/llgcode/draw2d/draw2dimg"
import "github.com/llgcode/draw2d/samples/android"
func main(){}
func main(){
// Initialize the graphic context on an RGBA image
dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0))
gc := draw2dimg.NewGraphicContext(dest)
// Draw Android logo
fn, err := android.Main(gc, "png")
if err != nil {
t.Errorf("Drawing %q failed: %v", fn, err)
log.Printf("Drawing %q failed: %v", fn, err)
return
}
// Save to png
err = draw2d.SaveToPngFile(fn, dest)
err = draw2dimg.SaveToPngFile(fn, dest)
if err != nil {
t.Errorf("Saving %q failed: %v", fn, err)
log.Printf("Saving %q failed: %v", fn, err)
return
}
log.Printf("Succesfully created %q", fn)
}
```

Expand Down

0 comments on commit 9ad7f79

Please sign in to comment.