1
0
mirror of https://github.com/golang/go synced 2024-11-22 05:24:39 -07:00

image/draw: add an Op argument to Draw.

R=r
CC=golang-dev
https://golang.org/cl/4622041
This commit is contained in:
Nigel Tao 2011-06-16 11:45:16 +10:00
parent 7fd51f2fb4
commit 9555ea7a5b
2 changed files with 4 additions and 4 deletions

View File

@ -34,9 +34,9 @@ type Image interface {
Set(x, y int, c image.Color) Set(x, y int, c image.Color)
} }
// Draw calls DrawMask with a nil mask and an Over op. // Draw calls DrawMask with a nil mask.
func Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point) { func Draw(dst Image, r image.Rectangle, src image.Image, sp image.Point, op Op) {
DrawMask(dst, r, src, sp, nil, image.ZP, Over) DrawMask(dst, r, src, sp, nil, image.ZP, op)
} }
// clip clips r against each image's bounds (after translating into the // clip clips r against each image's bounds (after translating into the

View File

@ -271,7 +271,7 @@ func TestNonZeroSrcPt(t *testing.T) {
b.Set(1, 0, image.RGBAColor{0, 0, 5, 5}) b.Set(1, 0, image.RGBAColor{0, 0, 5, 5})
b.Set(0, 1, image.RGBAColor{0, 5, 0, 5}) b.Set(0, 1, image.RGBAColor{0, 5, 0, 5})
b.Set(1, 1, image.RGBAColor{5, 0, 0, 5}) b.Set(1, 1, image.RGBAColor{5, 0, 0, 5})
Draw(a, image.Rect(0, 0, 1, 1), b, image.Pt(1, 1)) Draw(a, image.Rect(0, 0, 1, 1), b, image.Pt(1, 1), Over)
if !eq(image.RGBAColor{5, 0, 0, 5}, a.At(0, 0)) { if !eq(image.RGBAColor{5, 0, 0, 5}, a.At(0, 0)) {
t.Errorf("non-zero src pt: want %v got %v", image.RGBAColor{5, 0, 0, 5}, a.At(0, 0)) t.Errorf("non-zero src pt: want %v got %v", image.RGBAColor{5, 0, 0, 5}, a.At(0, 0))
} }