## Sunday, June 26, 2011

### Pixels, Peacocks, and the Governor's Turtle Fountain

Pixels are tiny, individual blocks of color that are used in computer displays. A common computer display may include many millions of individual pixels. By setting each pixel's color, the display can represent many different images. The number of pixels determines a screen's resolution, which in turn determines how complex a picture that screen can display. The key to many computer graphics algorithms is automatically determining how to set the color of each of the individual pixels.

Brian was the resident peacock at the governor's palace. For the past three years, he had been a main attraction there. His beautiful features were a sight to behold. Moreover, they were magical. Brian could change the color of each of his twenty tail feathers however he wanted. Some days, he would choose a single color for all of them to represent his mood. Other days, he would vary them to create complex patterns.

Thus, Brian was understandably jealous when a master wizard gave the governor a magical turtle fountain as a gift.

The fountain itself was not all that exciting, and the seven turtles that lived in it were certainly not magical. However, the bottom of the fountain was lined with over a million magic tiles that could change colors just like Brian's feathers. They were arranged in 1024 by 1024 square in the center of the fountain. At the Governor's command, they would change colors to form different murals.

One day Brian decided to confront the fountain. He walked up, squawked loudly, and changed his features into a beautiful rainbow of twenty different colors.

The fountain, having no real concept of the competition, gurgled happily. It instantly changed its tiles to be a picture of a peacock with rainbow tail feathers. The picture looked surprisingly like Brian.

Brian squawked angrily at the fountain's insult. His tail feathers shimmered in an oscillating wave of red and black. He called those his angry feathers. If he changed the colors fast enough, such as multiple times per second, it looked as though the colors were actually moving across his tail.

The fountain mimicked this motion. Unlike Brian, it could flip colors at an amazing 60 changes per second, providing the appearance of smooth motion. Deciding to take advantage of its ability to change colors vertically too, the fountain animated its picture of the peacock jumping up and down. It almost looked as though the angry peacock in the fountain was dancing.

Brian was furious. Unable to take the taunting, he wandered off to go chase visitors around the yard. At least the fountain could not do that.

Unaware that a competition had taken place or that it had won handily, the fountain continued to gurgle merrily.