freetype: update for image/draw changes.
R=r CC=golang-dev http://codereview.appspot.com/4620044
This commit is contained in:
parent
fdfcd83e81
commit
03e93b9a66
3 changed files with 8 additions and 8 deletions
|
@ -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)
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue