package main import "fmt" import "image" import "exp/draw" func main() { tile := image.NewRGBA(1, 1) tilesheet := image.NewRGBA(2, 2) tilesheet.Set(0, 0, image.RGBAColor{0, 0, 0, 255}) tilesheet.Set(1, 0, image.RGBAColor{0, 255, 0, 255}) tilesheet.Set(0, 1, image.RGBAColor{0, 0, 255, 255}) tilesheet.Set(1, 1, image.RGBAColor{255, 0, 0, 255}) // Draw the bottom right tile from the tilesheet. draw.Draw(tile, draw.Rect(0, 0, 1, 1), tilesheet, draw.Pt(1, 1)) fmt.Println(tile.At(0, 0)) // Should print "{255 0 0 255}" }