From 41885588783d99f1b5c47cc77308e2d5e1719f62 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Wed, 14 Sep 2011 22:02:41 +1000 Subject: [PATCH] freetype: update for image.NewXxx change. R=rsc CC=golang-dev http://codereview.appspot.com/4996046 --- example/freetype/main.go | 2 +- example/gamma/main.go | 4 ++-- example/raster/main.go | 4 ++-- example/round/main.go | 2 +- freetype/freetype.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/example/freetype/main.go b/example/freetype/main.go index 3714b61..56a626d 100644 --- a/example/freetype/main.go +++ b/example/freetype/main.go @@ -85,7 +85,7 @@ func main() { fg, bg = image.White, image.Black ruler = image.RGBAColor{0x22, 0x22, 0x22, 0xff} } - rgba := image.NewRGBA(640, 480) + rgba := image.NewRGBA(image.Rect(0, 0, 640, 480)) draw.Draw(rgba, rgba.Bounds(), bg, image.ZP, draw.Src) c := freetype.NewContext() c.SetDPI(*dpi) diff --git a/example/gamma/main.go b/example/gamma/main.go index 652eb42..ddd497b 100644 --- a/example/gamma/main.go +++ b/example/gamma/main.go @@ -39,10 +39,10 @@ func main() { w = 600 h = 200 ) - rgba := image.NewRGBA(w, h) + rgba := image.NewRGBA(image.Rect(0, 0, w, h)) 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) + mask := image.NewAlpha(image.Rect(0, 0, 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} for i, g := range gammas { diff --git a/example/raster/main.go b/example/raster/main.go index af04d63..6cca271 100644 --- a/example/raster/main.go +++ b/example/raster/main.go @@ -140,12 +140,12 @@ func main() { r := raster.NewRasterizer(w, h) contour(r, outside) contour(r, inside) - mask := image.NewAlpha(w, h) + mask := image.NewAlpha(image.Rect(0, 0, w, h)) p := raster.NewAlphaSrcPainter(mask) r.Rasterize(p) // Draw the mask image (in gray) onto an RGBA image. - rgba := image.NewRGBA(w, h) + rgba := image.NewRGBA(image.Rect(0, 0, w, h)) gray := image.NewColorImage(image.AlphaColor{0x1f}) draw.Draw(rgba, rgba.Bounds(), image.Black, image.ZP, draw.Src) draw.DrawMask(rgba, rgba.Bounds(), gray, image.ZP, mask, image.ZP, draw.Over) diff --git a/example/round/main.go b/example/round/main.go index 7e87cff..160e31e 100644 --- a/example/round/main.go +++ b/example/round/main.go @@ -31,7 +31,7 @@ func main() { s := raster.Fix32(r * math.Sqrt(2) / 2) t := raster.Fix32(r * math.Tan(math.Pi/8)) - m := image.NewRGBA(800, 600) + m := image.NewRGBA(image.Rect(0, 0, 800, 600)) draw.Draw(m, m.Bounds(), &image.ColorImage{image.RGBAColor{63, 63, 63, 255}}, image.ZP, draw.Src) mp := raster.NewRGBAPainter(m) mp.SetColor(image.Black) diff --git a/freetype/freetype.go b/freetype/freetype.go index cf36706..ff94b44 100644 --- a/freetype/freetype.go +++ b/freetype/freetype.go @@ -177,7 +177,7 @@ func (c *Context) rasterize(glyph truetype.Index, fx, fy raster.Fix32) (*image.A c.drawContour(c.glyphBuf.Point[e0:e1], fx, fy) e0 = e1 } - a := image.NewAlpha(xmax-xmin, ymax-ymin) + a := image.NewAlpha(image.Rect(0, 0, xmax-xmin, ymax-ymin)) c.r.Rasterize(raster.NewAlphaSrcPainter(a)) return a, image.Point{xmin, ymin}, nil }