From 03e93b9a6603d44ce8a48f4f080ca60d17ea2624 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 16 Jun 2011 12:25:21 +1000 Subject: [PATCH] freetype: update for image/draw changes. R=r CC=golang-dev http://codereview.appspot.com/4620044 --- example/freetype/main.go | 4 ++-- example/gamma/main.go | 6 +++--- example/raster/main.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/example/freetype/main.go b/example/freetype/main.go index 7a11caf..3714b61 100644 --- a/example/freetype/main.go +++ b/example/freetype/main.go @@ -7,11 +7,11 @@ package main import ( "bufio" - "exp/draw" "flag" "fmt" "freetype-go.googlecode.com/hg/freetype" "image" + "image/draw" "image/png" "io/ioutil" "log" @@ -86,7 +86,7 @@ func main() { ruler = image.RGBAColor{0x22, 0x22, 0x22, 0xff} } rgba := image.NewRGBA(640, 480) - draw.Draw(rgba, rgba.Bounds(), bg, image.ZP) + draw.Draw(rgba, rgba.Bounds(), bg, image.ZP, draw.Src) c := freetype.NewContext() c.SetDPI(*dpi) c.SetFont(font) diff --git a/example/gamma/main.go b/example/gamma/main.go index cc25475..8fe4539 100644 --- a/example/gamma/main.go +++ b/example/gamma/main.go @@ -7,9 +7,9 @@ package main import ( "bufio" - "exp/draw" "fmt" "image" + "image/draw" "image/png" "log" "os" @@ -51,8 +51,8 @@ func main() { h = 200 ) rgba := image.NewRGBA(w, h) - draw.Draw(rgba, image.Rect(0, 0, w, h/2), image.Black, image.ZP) - draw.Draw(rgba, image.Rect(0, h/2, w, h), image.White, image.ZP) + draw.Draw(rgba, image.Rect(0, 0, w, h/2), image.Black, image.ZP, draw.Src) + draw.Draw(rgba, image.Rect(0, h/2, w, h), image.White, image.ZP, draw.Src) mask := image.NewAlpha(50, 50) painter := raster.NewAlphaSrcPainter(mask) gammas := []float64{1.0 / 10.0, 1.0 / 3.0, 1.0 / 2.0, 2.0 / 3.0, 4.0 / 5.0, 1.0, 5.0 / 4.0, 3.0 / 2.0, 2.0, 3.0, 10.0} diff --git a/example/raster/main.go b/example/raster/main.go index 3861592..af04d63 100644 --- a/example/raster/main.go +++ b/example/raster/main.go @@ -7,9 +7,9 @@ package main import ( "bufio" - "exp/draw" "fmt" "image" + "image/draw" "image/png" "log" "os" @@ -113,7 +113,7 @@ func showNodes(m *image.RGBA, ns []node) { for _, n := range ns { p := p(n) x, y := int(p.X)/256, int(p.Y)/256 - if !m.Bounds().Contains(image.Point{x, y}) { + if !(image.Point{x, y}).In(m.Bounds()) { continue } var c image.Color @@ -147,7 +147,7 @@ func main() { // Draw the mask image (in gray) onto an RGBA image. rgba := image.NewRGBA(w, h) gray := image.NewColorImage(image.AlphaColor{0x1f}) - draw.Draw(rgba, rgba.Bounds(), image.Black, image.ZP) + draw.Draw(rgba, rgba.Bounds(), image.Black, image.ZP, draw.Src) draw.DrawMask(rgba, rgba.Bounds(), gray, image.ZP, mask, image.ZP, draw.Over) showNodes(rgba, outside) showNodes(rgba, inside)