var dst Image
switch dcm {
case image.RGBAColorModel:
- dst1 := image.NewRGBA(dstw, dsth)
+ dst1 := image.NewRGBA(image.Rect(0, 0, dstw, dsth))
for y := 0; y < dsth; y++ {
for x := 0; x < dstw; x++ {
dst1.SetRGBA(x, y, image.RGBAColor{
}
dst = dst1
case image.RGBA64ColorModel:
- dst1 := image.NewRGBA64(dstw, dsth)
+ dst1 := image.NewRGBA64(image.Rect(0, 0, dstw, dsth))
for y := 0; y < dsth; y++ {
for x := 0; x < dstw; x++ {
dst1.SetRGBA64(x, y, image.RGBA64Color{
case nil:
src = &image.ColorImage{image.RGBAColor{0x11, 0x22, 0x33, 0xff}}
case image.RGBAColorModel:
- src1 := image.NewRGBA(srcw, srch)
+ src1 := image.NewRGBA(image.Rect(0, 0, srcw, srch))
for y := 0; y < srch; y++ {
for x := 0; x < srcw; x++ {
src1.SetRGBA(x, y, image.RGBAColor{
}
src = src1
case image.RGBA64ColorModel:
- src1 := image.NewRGBA64(srcw, srch)
+ src1 := image.NewRGBA64(image.Rect(0, 0, srcw, srch))
for y := 0; y < srch; y++ {
for x := 0; x < srcw; x++ {
src1.SetRGBA64(x, y, image.RGBA64Color{
}
src = src1
case image.NRGBAColorModel:
- src1 := image.NewNRGBA(srcw, srch)
+ src1 := image.NewNRGBA(image.Rect(0, 0, srcw, srch))
for y := 0; y < srch; y++ {
for x := 0; x < srcw; x++ {
src1.SetNRGBA(x, y, image.NRGBAColor{
case nil:
// No-op.
case image.AlphaColorModel:
- mask1 := image.NewAlpha(srcw, srch)
+ mask1 := image.NewAlpha(image.Rect(0, 0, srcw, srch))
for y := 0; y < srch; y++ {
for x := 0; x < srcw; x++ {
a := uint8((23*x + 29*y) % 0x100)
}
func vgradGreen(alpha int) image.Image {
- m := image.NewRGBA(16, 16)
+ m := image.NewRGBA(image.Rect(0, 0, 16, 16))
for y := 0; y < 16; y++ {
for x := 0; x < 16; x++ {
m.Set(x, y, image.RGBAColor{0, uint8(y * alpha / 15), 0, uint8(alpha)})
}
func vgradAlpha(alpha int) image.Image {
- m := image.NewAlpha(16, 16)
+ m := image.NewAlpha(image.Rect(0, 0, 16, 16))
for y := 0; y < 16; y++ {
for x := 0; x < 16; x++ {
m.Set(x, y, image.AlphaColor{uint8(y * alpha / 15)})
}
func vgradGreenNRGBA(alpha int) image.Image {
- m := image.NewNRGBA(16, 16)
+ m := image.NewNRGBA(image.Rect(0, 0, 16, 16))
for y := 0; y < 16; y++ {
for x := 0; x < 16; x++ {
m.Set(x, y, image.RGBAColor{0, uint8(y * 0x11), 0, uint8(alpha)})
}
func hgradRed(alpha int) Image {
- m := image.NewRGBA(16, 16)
+ m := image.NewRGBA(image.Rect(0, 0, 16, 16))
for y := 0; y < 16; y++ {
for x := 0; x < 16; x++ {
m.Set(x, y, image.RGBAColor{uint8(x * alpha / 15), 0, 0, uint8(alpha)})
}
func gradYellow(alpha int) Image {
- m := image.NewRGBA(16, 16)
+ m := image.NewRGBA(image.Rect(0, 0, 16, 16))
for y := 0; y < 16; y++ {
for x := 0; x < 16; x++ {
m.Set(x, y, image.RGBAColor{uint8(x * alpha / 15), uint8(y * alpha / 15), 0, uint8(alpha)})
if mask != nil {
mb = mask.Bounds()
}
- golden := image.NewRGBA(b.Max.X, b.Max.Y)
+ golden := image.NewRGBA(image.Rect(0, 0, b.Max.X, b.Max.Y))
for y := r.Min.Y; y < r.Max.Y; y++ {
sy := y + sp.Y - r.Min.Y
my := y + mp.Y - r.Min.Y
// TestNonZeroSrcPt checks drawing with a non-zero src point parameter.
func TestNonZeroSrcPt(t *testing.T) {
- a := image.NewRGBA(1, 1)
- b := image.NewRGBA(2, 2)
+ a := image.NewRGBA(image.Rect(0, 0, 1, 1))
+ b := image.NewRGBA(image.Rect(0, 0, 2, 2))
b.Set(0, 0, image.RGBAColor{0, 0, 0, 5})
b.Set(1, 0, image.RGBAColor{0, 0, 5, 5})
b.Set(0, 1, image.RGBAColor{0, 5, 0, 5})
image.Rect(20, 20, 29, 29),
}
for _, r := range rr {
- m := image.NewRGBA(40, 30).SubImage(r).(*image.RGBA)
+ m := image.NewRGBA(image.Rect(0, 0, 40, 30)).SubImage(r).(*image.RGBA)
b := m.Bounds()
c := image.RGBAColor{11, 0, 0, 255}
src := &image.ColorImage{c}