Replace remaining draw2d.NewGraphicContext instances.

This commit is contained in:
Steven Edwards 2015-08-19 15:42:16 -04:00
parent bf42fff416
commit 0e0aa125a3
6 changed files with 8 additions and 8 deletions

View File

@ -61,7 +61,7 @@ The same Go code can also generate a pdf document with package draw2dpdf:
```go ```go
// Initialize the graphic context on an RGBA image // Initialize the graphic context on an RGBA image
dest := draw2dpdf.NewPdf("L", "mm", "A4") dest := draw2dpdf.NewPdf("L", "mm", "A4")
gc := draw2d.NewGraphicContext(dest) gc := draw2dpdf.NewGraphicContext(dest)
// Set some properties // Set some properties
gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff}) gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff})

View File

@ -28,7 +28,7 @@
// generates a simple drawing and saves it to an image file: // generates a simple drawing and saves it to an image file:
// // Initialize the graphic context on an RGBA image // // Initialize the graphic context on an RGBA image
// dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0)) // dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0))
// gc := draw2d.NewGraphicContext(dest) // gc := draw2dimg.NewGraphicContext(dest)
// //
// // Set some properties // // Set some properties
// gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff}) // gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff})

View File

@ -10,7 +10,7 @@ The following Go code generates a simple drawing and saves it to a pdf document:
```go ```go
// Initialize the graphic context on an RGBA image // Initialize the graphic context on an RGBA image
dest := draw2dpdf.NewPdf("L", "mm", "A4") dest := draw2dpdf.NewPdf("L", "mm", "A4")
gc := draw2d.NewGraphicContext(dest) gc := draw2dpdf.NewGraphicContext(dest)
// Set some properties // Set some properties
gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff}) gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff})
@ -39,4 +39,4 @@ Alternative backends
Acknowledgments Acknowledgments
--------------- ---------------
The pdf backend uses https://github.com/jung-kurt/gofpdf The pdf backend uses https://github.com/jung-kurt/gofpdf

View File

@ -10,7 +10,7 @@
// pdf document: // pdf document:
// // Initialize the graphic context on an RGBA image // // Initialize the graphic context on an RGBA image
// dest := draw2dpdf.NewPdf("L", "mm", "A4") // dest := draw2dpdf.NewPdf("L", "mm", "A4")
// gc := draw2d.NewGraphicContext(dest) // gc := draw2dpdf.NewGraphicContext(dest)
// //
// // Set some properties // // Set some properties
// gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff}) // gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff})

View File

@ -19,7 +19,7 @@ import (
function main(){} function main(){}
// Initialize the graphic context on an RGBA image // Initialize the graphic context on an RGBA image
dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0)) dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0))
gc := draw2d.NewGraphicContext(dest) gc := draw2dimg.NewGraphicContext(dest)
// Draw Android logo // Draw Android logo
fn, err := android.Main(gc, "png") fn, err := android.Main(gc, "png")
if err != nil { if err != nil {

View File

@ -9,7 +9,7 @@ import (
"image/png" "image/png"
"net/http" "net/http"
"github.com/llgcode/draw2d" "github.com/llgcode/draw2d/draw2dimg"
"github.com/llgcode/draw2d/draw2dpdf" "github.com/llgcode/draw2d/draw2dpdf"
"github.com/llgcode/draw2d/samples/android" "github.com/llgcode/draw2d/samples/android"
@ -59,7 +59,7 @@ func imgPng(w http.ResponseWriter, r *http.Request) *appError {
// Initialize the graphic context on an RGBA image // Initialize the graphic context on an RGBA image
dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0)) dest := image.NewRGBA(image.Rect(0, 0, 297, 210.0))
gc := draw2d.NewGraphicContext(dest) gc := draw2dimg.NewGraphicContext(dest)
// Draw sample // Draw sample
android.Draw(gc, 65, 0) android.Draw(gc, 65, 0)