]> Cypherpunks repositories - gostls13.git/commitdiff
image: add RGBAAt, Gray16At, etc.
authorChaiShushan <chaishushan@gmail.com>
Thu, 19 Jun 2014 00:15:04 +0000 (10:15 +1000)
committerNigel Tao <nigeltao@golang.org>
Thu, 19 Jun 2014 00:15:04 +0000 (10:15 +1000)
Fixes #7694.

LGTM=nigeltao, rsc, r
R=golang-codereviews, nigeltao, rsc, r
CC=golang-codereviews
https://golang.org/cl/109000049

src/pkg/image/image.go
src/pkg/image/ycbcr.go

index 32a89ef34ca8c1e9326bf136ffc9445a25bdbc40..6b8e5c4877e27b5fef3bab8d5bfb1c0da956a5cb 100644 (file)
@@ -72,6 +72,10 @@ func (p *RGBA) ColorModel() color.Model { return color.RGBAModel }
 func (p *RGBA) Bounds() Rectangle { return p.Rect }
 
 func (p *RGBA) At(x, y int) color.Color {
+       return p.RGBAAt(x, y)
+}
+
+func (p *RGBA) RGBAAt(x, y int) color.RGBA {
        if !(Point{x, y}.In(p.Rect)) {
                return color.RGBA{}
        }
@@ -167,6 +171,10 @@ func (p *RGBA64) ColorModel() color.Model { return color.RGBA64Model }
 func (p *RGBA64) Bounds() Rectangle { return p.Rect }
 
 func (p *RGBA64) At(x, y int) color.Color {
+       return p.RGBA64At(x, y)
+}
+
+func (p *RGBA64) RGBA64At(x, y int) color.RGBA64 {
        if !(Point{x, y}.In(p.Rect)) {
                return color.RGBA64{}
        }
@@ -275,6 +283,10 @@ func (p *NRGBA) ColorModel() color.Model { return color.NRGBAModel }
 func (p *NRGBA) Bounds() Rectangle { return p.Rect }
 
 func (p *NRGBA) At(x, y int) color.Color {
+       return p.NRGBAAt(x, y)
+}
+
+func (p *NRGBA) NRGBAAt(x, y int) color.NRGBA {
        if !(Point{x, y}.In(p.Rect)) {
                return color.NRGBA{}
        }
@@ -370,6 +382,10 @@ func (p *NRGBA64) ColorModel() color.Model { return color.NRGBA64Model }
 func (p *NRGBA64) Bounds() Rectangle { return p.Rect }
 
 func (p *NRGBA64) At(x, y int) color.Color {
+       return p.NRGBA64At(x, y)
+}
+
+func (p *NRGBA64) NRGBA64At(x, y int) color.NRGBA64 {
        if !(Point{x, y}.In(p.Rect)) {
                return color.NRGBA64{}
        }
@@ -478,6 +494,10 @@ func (p *Alpha) ColorModel() color.Model { return color.AlphaModel }
 func (p *Alpha) Bounds() Rectangle { return p.Rect }
 
 func (p *Alpha) At(x, y int) color.Color {
+       return p.AlphaAt(x, y)
+}
+
+func (p *Alpha) AlphaAt(x, y int) color.Alpha {
        if !(Point{x, y}.In(p.Rect)) {
                return color.Alpha{}
        }
@@ -566,6 +586,10 @@ func (p *Alpha16) ColorModel() color.Model { return color.Alpha16Model }
 func (p *Alpha16) Bounds() Rectangle { return p.Rect }
 
 func (p *Alpha16) At(x, y int) color.Color {
+       return p.Alpha16At(x, y)
+}
+
+func (p *Alpha16) Alpha16At(x, y int) color.Alpha16 {
        if !(Point{x, y}.In(p.Rect)) {
                return color.Alpha16{}
        }
@@ -657,6 +681,10 @@ func (p *Gray) ColorModel() color.Model { return color.GrayModel }
 func (p *Gray) Bounds() Rectangle { return p.Rect }
 
 func (p *Gray) At(x, y int) color.Color {
+       return p.GrayAt(x, y)
+}
+
+func (p *Gray) GrayAt(x, y int) color.Gray {
        if !(Point{x, y}.In(p.Rect)) {
                return color.Gray{}
        }
@@ -732,6 +760,10 @@ func (p *Gray16) ColorModel() color.Model { return color.Gray16Model }
 func (p *Gray16) Bounds() Rectangle { return p.Rect }
 
 func (p *Gray16) At(x, y int) color.Color {
+       return p.Gray16At(x, y)
+}
+
+func (p *Gray16) Gray16At(x, y int) color.Gray16 {
        if !(Point{x, y}.In(p.Rect)) {
                return color.Gray16{}
        }
index 5b73bef789581e21a684362dd8deec35ab0b3dfc..7c773f2f0a496049b763e60f3bb608c74a197312 100644 (file)
@@ -60,6 +60,10 @@ func (p *YCbCr) Bounds() Rectangle {
 }
 
 func (p *YCbCr) At(x, y int) color.Color {
+       return p.YCbCrAt(x, y)
+}
+
+func (p *YCbCr) YCbCrAt(x, y int) color.YCbCr {
        if !(Point{x, y}.In(p.Rect)) {
                return color.YCbCr{}
        }