freetype: update for image.NewXxx change.

R=rsc
CC=golang-dev
http://codereview.appspot.com/4996046
This commit is contained in:
Nigel Tao 2011-09-14 22:02:41 +10:00
parent 9385f060bc
commit 4188558878
5 changed files with 7 additions and 7 deletions

View file

@ -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)

View file

@ -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 {

View file

@ -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)

View file

@ -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)

View file

@ -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
}