summaryrefslogtreecommitdiff
path: root/src/pkg/image/draw/draw.go
diff options
context:
space:
mode:
authorNigel Tao <nigeltao@golang.org>2011-12-21 10:29:21 +1100
committerNigel Tao <nigeltao@golang.org>2011-12-21 10:29:21 +1100
commit553bc2fd55434f7379d489b4af5fb90e2c6e9f4c (patch)
tree85430ff264a50b3a0f680976a0386cf4e17fd69c /src/pkg/image/draw/draw.go
parent865e34622fee665b8042b154b48ef81567199336 (diff)
downloadgo-553bc2fd55434f7379d489b4af5fb90e2c6e9f4c.tar.gz
image/ycbcr: move the Y'CbCr types into image and image/color.
R=r, rsc CC=golang-dev http://codereview.appspot.com/5493084
Diffstat (limited to 'src/pkg/image/draw/draw.go')
-rw-r--r--src/pkg/image/draw/draw.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/pkg/image/draw/draw.go b/src/pkg/image/draw/draw.go
index af02639cc..228ed6e71 100644
--- a/src/pkg/image/draw/draw.go
+++ b/src/pkg/image/draw/draw.go
@@ -11,7 +11,6 @@ package draw
import (
"image"
"image/color"
- "image/ycbcr"
)
// m is the maximum color value returned by image.Color.RGBA.
@@ -81,7 +80,7 @@ func DrawMask(dst Image, r image.Rectangle, src image.Image, sp image.Point, mas
case *image.NRGBA:
drawNRGBAOver(dst0, r, src0, sp)
return
- case *ycbcr.YCbCr:
+ case *image.YCbCr:
drawYCbCr(dst0, r, src0, sp)
return
}
@@ -104,7 +103,7 @@ func DrawMask(dst Image, r image.Rectangle, src image.Image, sp image.Point, mas
case *image.NRGBA:
drawNRGBASrc(dst0, r, src0, sp)
return
- case *ycbcr.YCbCr:
+ case *image.YCbCr:
drawYCbCr(dst0, r, src0, sp)
return
}
@@ -346,8 +345,8 @@ func drawNRGBASrc(dst *image.RGBA, r image.Rectangle, src *image.NRGBA, sp image
}
}
-func drawYCbCr(dst *image.RGBA, r image.Rectangle, src *ycbcr.YCbCr, sp image.Point) {
- // A YCbCr image is always fully opaque, and so if the mask is implicitly nil
+func drawYCbCr(dst *image.RGBA, r image.Rectangle, src *image.YCbCr, sp image.Point) {
+ // An image.YCbCr is always fully opaque, and so if the mask is implicitly nil
// (i.e. fully opaque) then the op is effectively always Src.
var (
yy, cb, cr uint8
@@ -357,7 +356,7 @@ func drawYCbCr(dst *image.RGBA, r image.Rectangle, src *ycbcr.YCbCr, sp image.Po
y0 := r.Min.Y - dst.Rect.Min.Y
y1 := r.Max.Y - dst.Rect.Min.Y
switch src.SubsampleRatio {
- case ycbcr.SubsampleRatio422:
+ case image.YCbCrSubsampleRatio422:
for y, sy := y0, sp.Y; y != y1; y, sy = y+1, sy+1 {
dpix := dst.Pix[y*dst.Stride:]
for x, sx := x0, sp.X; x != x1; x, sx = x+4, sx+1 {
@@ -365,14 +364,14 @@ func drawYCbCr(dst *image.RGBA, r image.Rectangle, src *ycbcr.YCbCr, sp image.Po
yy = src.Y[sy*src.YStride+sx]
cb = src.Cb[sy*src.CStride+i]
cr = src.Cr[sy*src.CStride+i]
- rr, gg, bb := ycbcr.YCbCrToRGB(yy, cb, cr)
+ rr, gg, bb := color.YCbCrToRGB(yy, cb, cr)
dpix[x+0] = rr
dpix[x+1] = gg
dpix[x+2] = bb
dpix[x+3] = 255
}
}
- case ycbcr.SubsampleRatio420:
+ case image.YCbCrSubsampleRatio420:
for y, sy := y0, sp.Y; y != y1; y, sy = y+1, sy+1 {
dpix := dst.Pix[y*dst.Stride:]
for x, sx := x0, sp.X; x != x1; x, sx = x+4, sx+1 {
@@ -380,7 +379,7 @@ func drawYCbCr(dst *image.RGBA, r image.Rectangle, src *ycbcr.YCbCr, sp image.Po
yy = src.Y[sy*src.YStride+sx]
cb = src.Cb[j*src.CStride+i]
cr = src.Cr[j*src.CStride+i]
- rr, gg, bb := ycbcr.YCbCrToRGB(yy, cb, cr)
+ rr, gg, bb := color.YCbCrToRGB(yy, cb, cr)
dpix[x+0] = rr
dpix[x+1] = gg
dpix[x+2] = bb
@@ -395,7 +394,7 @@ func drawYCbCr(dst *image.RGBA, r image.Rectangle, src *ycbcr.YCbCr, sp image.Po
yy = src.Y[sy*src.YStride+sx]
cb = src.Cb[sy*src.CStride+sx]
cr = src.Cr[sy*src.CStride+sx]
- rr, gg, bb := ycbcr.YCbCrToRGB(yy, cb, cr)
+ rr, gg, bb := color.YCbCrToRGB(yy, cb, cr)
dpix[x+0] = rr
dpix[x+1] = gg
dpix[x+2] = bb