Merge pull request #78 from stephenwithav/newgraphicontexts
Replace remaining draw2d.NewGraphicContext instances.
This commit is contained in:
commit
ad6b615bc4
6 changed files with 8 additions and 8 deletions
|
@ -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})
|
||||||
|
|
|
@ -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})
|
||||||
|
|
|
@ -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})
|
||||||
|
|
|
@ -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})
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue