freetype-go: update examples for draw.Rect being renamed to image.Rect.
R=r CC=golang-dev http://codereview.appspot.com/1961046
This commit is contained in:
parent
acecb39ad9
commit
6a75ac002d
|
@ -88,7 +88,7 @@ func main() {
|
|||
ruler = image.RGBAColor{0x22, 0x22, 0x22, 0xff}
|
||||
}
|
||||
rgba := image.NewRGBA(640, 480)
|
||||
draw.Draw(rgba, draw.Rect(0, 0, 640, 480), bg, draw.ZP)
|
||||
draw.Draw(rgba, rgba.Bounds(), bg, image.ZP)
|
||||
c := freetype.NewContext()
|
||||
c.SetDPI(*dpi)
|
||||
c.SetFont(font)
|
||||
|
|
|
@ -51,8 +51,8 @@ func main() {
|
|||
h = 200
|
||||
)
|
||||
rgba := image.NewRGBA(w, h)
|
||||
draw.Draw(rgba, draw.Rect(0, 0, w, h/2), image.Black, draw.ZP)
|
||||
draw.Draw(rgba, draw.Rect(0, h/2, w, h), image.White, draw.ZP)
|
||||
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)
|
||||
mask := image.NewAlpha(50, 50)
|
||||
painter := raster.NewAlphaPainter(mask)
|
||||
painter.Op = draw.Src
|
||||
|
@ -61,9 +61,9 @@ func main() {
|
|||
clear(mask)
|
||||
r.Rasterize(raster.NewGammaCorrectionPainter(painter, g))
|
||||
x, y := 50*i+25, 25
|
||||
draw.DrawMask(rgba, draw.Rect(x, y, x+50, y+50), image.White, draw.ZP, mask, draw.ZP, draw.Over)
|
||||
draw.DrawMask(rgba, image.Rect(x, y, x+50, y+50), image.White, image.ZP, mask, image.ZP, draw.Over)
|
||||
y += 100
|
||||
draw.DrawMask(rgba, draw.Rect(x, y, x+50, y+50), image.Black, draw.ZP, mask, draw.ZP, draw.Over)
|
||||
draw.DrawMask(rgba, image.Rect(x, y, x+50, y+50), image.Black, image.ZP, mask, image.ZP, draw.Over)
|
||||
}
|
||||
|
||||
// Save that RGBA image to disk.
|
||||
|
|
|
@ -148,8 +148,8 @@ func main() {
|
|||
// Draw the mask image (in gray) onto an RGBA image.
|
||||
rgba := image.NewRGBA(w, h)
|
||||
gray := image.ColorImage{image.AlphaColor{0x1f}}
|
||||
draw.Draw(rgba, draw.Rect(0, 0, w, h), image.Black, draw.ZP)
|
||||
draw.DrawMask(rgba, draw.Rect(0, 0, w, h), gray, draw.ZP, mask, draw.ZP, draw.Over)
|
||||
draw.Draw(rgba, rgba.Bounds(), image.Black, image.ZP)
|
||||
draw.DrawMask(rgba, rgba.Bounds(), gray, image.ZP, mask, image.ZP, draw.Over)
|
||||
showNodes(rgba, outside)
|
||||
showNodes(rgba, inside)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user