diff --git a/example/freetype/main.go b/example/freetype/main.go index 56a626d..15e312a 100644 --- a/example/freetype/main.go +++ b/example/freetype/main.go @@ -11,6 +11,7 @@ import ( "fmt" "freetype-go.googlecode.com/hg/freetype" "image" + "image/color" "image/draw" "image/png" "io/ioutil" @@ -80,10 +81,10 @@ func main() { // Initialize the context. fg, bg := image.Black, image.White - ruler := image.RGBAColor{0xdd, 0xdd, 0xdd, 0xff} + ruler := color.RGBA{0xdd, 0xdd, 0xdd, 0xff} if *wonb { fg, bg = image.White, image.Black - ruler = image.RGBAColor{0x22, 0x22, 0x22, 0xff} + ruler = color.RGBA{0x22, 0x22, 0x22, 0xff} } rgba := image.NewRGBA(image.Rect(0, 0, 640, 480)) draw.Draw(rgba, rgba.Bounds(), bg, image.ZP, draw.Src) diff --git a/example/raster/main.go b/example/raster/main.go index 6cca271..d540d13 100644 --- a/example/raster/main.go +++ b/example/raster/main.go @@ -9,6 +9,7 @@ import ( "bufio" "fmt" "image" + "image/color" "image/draw" "image/png" "log" @@ -116,14 +117,14 @@ func showNodes(m *image.RGBA, ns []node) { if !(image.Point{x, y}).In(m.Bounds()) { continue } - var c image.Color + var c color.Color switch n.degree { case 0: - c = image.RGBAColor{0, 255, 255, 255} + c = color.RGBA{0, 255, 255, 255} case 1: - c = image.RGBAColor{255, 0, 0, 255} + c = color.RGBA{255, 0, 0, 255} case 2: - c = image.RGBAColor{255, 0, 0, 255} + c = color.RGBA{255, 0, 0, 255} } if c != nil { m.Set(x, y, c) @@ -146,7 +147,7 @@ func main() { // Draw the mask image (in gray) onto an RGBA image. rgba := image.NewRGBA(image.Rect(0, 0, w, h)) - gray := image.NewColorImage(image.AlphaColor{0x1f}) + gray := image.NewUniform(color.Alpha{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) showNodes(rgba, outside) diff --git a/example/round/main.go b/example/round/main.go index 160e31e..2b586b9 100644 --- a/example/round/main.go +++ b/example/round/main.go @@ -14,6 +14,7 @@ import ( "bufio" "fmt" "image" + "image/color" "image/draw" "image/png" "log" @@ -32,7 +33,7 @@ func main() { t := raster.Fix32(r * math.Tan(math.Pi/8)) 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) + draw.Draw(m, m.Bounds(), &image.Uniform{color.RGBA{63, 63, 63, 255}}, image.ZP, draw.Src) mp := raster.NewRGBAPainter(m) mp.SetColor(image.Black) z := raster.NewRasterizer(800, 600) @@ -69,7 +70,7 @@ func main() { theta := math.Pi * float64(j) / (n - 1) dx := raster.Fix32(r * math.Cos(theta)) dy := raster.Fix32(r * math.Sin(theta)) - m.Set(int((cx+dx)/256), int((cy+dy)/256), image.RGBAColor{255, 255, 0, 255}) + m.Set(int((cx+dx)/256), int((cy+dy)/256), color.RGBA{255, 255, 0, 255}) } } diff --git a/freetype/raster/paint.go b/freetype/raster/paint.go index 9b01bca..cf6f305 100644 --- a/freetype/raster/paint.go +++ b/freetype/raster/paint.go @@ -7,6 +7,7 @@ package raster import ( "image" + "image/color" "image/draw" "math" ) @@ -169,7 +170,7 @@ func (r *RGBAPainter) Paint(ss []Span, done bool) { } // SetColor sets the color to paint the spans. -func (r *RGBAPainter) SetColor(c image.Color) { +func (r *RGBAPainter) SetColor(c color.Color) { r.cr, r.cg, r.cb, r.ca = c.RGBA() }