Skip to content

Instantly share code, notes, and snippets.

@stephenwithav
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephenwithav/a4b995cdda566c6a8cbc to your computer and use it in GitHub Desktop.
Save stephenwithav/a4b995cdda566c6a8cbc to your computer and use it in GitHub Desktop.
Android shifted down
package main
import (
"fmt"
"image"
"log"
"github.com/llgcode/draw2d/draw2dimg"
"github.com/llgcode/draw2d/samples/android"
)
func main() {
// Initialize the graphic context on an RGBA image
dest := image.NewRGBA(image.Rect(0, 0, 297, 185))
gc := draw2dimg.NewGraphicContext(dest)
// Draw Android logo
gc.Translate(0, 25)
fn, err := android.Main(gc, "png")
fmt.Println(fn)
if err != nil {
log.Printf("Drawing %q failed: %v", fn, err)
return
}
// Save to png
err = draw2dimg.SaveToPngFile(fn, dest)
if err != nil {
log.Printf("Saving %q failed: %v", fn, err)
}
}
package main
import (
"fmt"
"image"
"log"
"github.com/llgcode/draw2d/draw2dimg"
"github.com/llgcode/draw2d/samples/android"
)
func main() {
// Initialize the graphic context on an RGBA image
dest := image.NewRGBA(image.Rect(0, 50, 297, 210.0))
gc := draw2dimg.NewGraphicContext(dest)
// Draw Android logo
fn, err := android.Main(gc, "png")
fmt.Println(fn)
if err != nil {
log.Printf("Drawing %q failed: %v", fn, err)
return
}
// Save to png
err = draw2dimg.SaveToPngFile(fn, dest)
if err != nil {
log.Printf("Saving %q failed: %v", fn, err)
}
}
package main
import (
"fmt"
"image"
"log"
"github.com/llgcode/draw2d/draw2dimg"
"github.com/llgcode/draw2d/samples/android"
)
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")
fmt.Println(fn)
if err != nil {
log.Printf("Drawing %q failed: %v", fn, err)
return
}
// Save to png
err = draw2dimg.SaveToPngFile(fn, dest)
if err != nil {
log.Printf("Saving %q failed: %v", fn, err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment