doc: added The Go image package article

Orignally published on The Go Programming Language, September 21, 2011.

http://blog.golang.org/2011/09/go-image-package.html

Update #2547

R=adg, nigeltao
CC=golang-dev
https://golang.org/cl/5933049
diff --git a/doc/progs/image_package1.go b/doc/progs/image_package1.go
new file mode 100644
index 0000000..c4c401e
--- /dev/null
+++ b/doc/progs/image_package1.go
@@ -0,0 +1,15 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"fmt"
+	"image"
+)
+
+func main() {
+	p := image.Point{2, 1}
+	fmt.Println("X is", p.X, "Y is", p.Y)
+}
diff --git a/doc/progs/image_package2.go b/doc/progs/image_package2.go
new file mode 100644
index 0000000..fcb5d9f
--- /dev/null
+++ b/doc/progs/image_package2.go
@@ -0,0 +1,16 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"fmt"
+	"image"
+)
+
+func main() {
+	r := image.Rect(2, 1, 5, 5)
+	// Dx and Dy return a rectangle's width and height.
+	fmt.Println(r.Dx(), r.Dy(), image.Pt(0, 0).In(r)) // prints 3 4 false
+}
diff --git a/doc/progs/image_package3.go b/doc/progs/image_package3.go
new file mode 100644
index 0000000..13d0f08
--- /dev/null
+++ b/doc/progs/image_package3.go
@@ -0,0 +1,15 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"fmt"
+	"image"
+)
+
+func main() {
+	r := image.Rect(2, 1, 5, 5).Add(image.Pt(-4, -2))
+	fmt.Println(r.Dx(), r.Dy(), image.Pt(0, 0).In(r)) // prints 3 4 true
+}
diff --git a/doc/progs/image_package4.go b/doc/progs/image_package4.go
new file mode 100644
index 0000000..c46fddf
--- /dev/null
+++ b/doc/progs/image_package4.go
@@ -0,0 +1,16 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"fmt"
+	"image"
+)
+
+func main() {
+	r := image.Rect(0, 0, 4, 3).Intersect(image.Rect(2, 2, 5, 5))
+	// Size returns a rectangle's width and height, as a Point.
+	fmt.Printf("%#v\n", r.Size()) // prints image.Point{X:2, Y:1}
+}
diff --git a/doc/progs/image_package5.go b/doc/progs/image_package5.go
new file mode 100644
index 0000000..0bb5c76
--- /dev/null
+++ b/doc/progs/image_package5.go
@@ -0,0 +1,17 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"fmt"
+	"image"
+	"image/color"
+)
+
+func main() {
+	m := image.NewRGBA(image.Rect(0, 0, 640, 480))
+	m.Set(5, 5, color.RGBA{255, 0, 0, 255})
+	fmt.Println(m.At(5, 5))
+}
diff --git a/doc/progs/image_package6.go b/doc/progs/image_package6.go
new file mode 100644
index 0000000..62eeecd
--- /dev/null
+++ b/doc/progs/image_package6.go
@@ -0,0 +1,17 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+	"fmt"
+	"image"
+)
+
+func main() {
+	m0 := image.NewRGBA(image.Rect(0, 0, 8, 5))
+	m1 := m0.SubImage(image.Rect(1, 2, 5, 5)).(*image.RGBA)
+	fmt.Println(m0.Bounds().Dx(), m1.Bounds().Dx()) // prints 8, 4
+	fmt.Println(m0.Stride == m1.Stride)             // prints true
+}
diff --git a/doc/progs/run b/doc/progs/run
index 8348a33..92c8da5 100755
--- a/doc/progs/run
+++ b/doc/progs/run
@@ -59,7 +59,16 @@
 	json5
 "
 
-all=$(echo $defer_panic_recover $effective_go $error_handling $law_of_reflection $c_go_cgo $timeout $gobs $json slices go1)
+image_package="
+	image_package1
+	image_package2
+	image_package3
+	image_package4
+	image_package5
+	image_package6
+"
+
+all=$(echo $defer_panic_recover $effective_go $error_handling $law_of_reflection $c_go_cgo $timeout $gobs $json $image_package slices go1)
 
 for i in $all; do
 	go build $i.go
@@ -87,9 +96,17 @@
 testit go1 '^Christmas is a holiday: true Sleeping for 0.123s.*go1.go already exists$'
 
 testit interface2 "^type: float64$"
+
 testit json1 "^$"
 testit json2 "the reciprocal of i is"
 testit json3 "Age is int 6"
 testit json4 "^$"
 
+testit image_package1 "^X is 2 Y is 1$"
+testit image_package2 "^3 4 false$"
+testit image_package3 "^3 4 true$"
+testit image_package4 "^image.Point{X:2, Y:1}$"
+testit image_package5 "^{255 0 0 255}$"
+testit image_package6 "^8 4 true$"
+
 rm -f $all "$TMPFILE"