GAme

tiistai 26. kesäkuuta 2012

Pixels

The image on your computer's display consists of a bunch of colored points called pixels.  A pixel is an object.  It has a color and a position (its coordinates) which consists of the row and column it is at.  Figure 1.1 shows an artist's rendition, a magnification of a display with a circle drawn in yellow.  The tiny black dots are the pixels and the big yellow dots are the pixels that have been colored.
Pixel Circle Figure 1.1
As an example, to display a thin vertical line, the color values of a column of pixels are set to the desired color of the line.  If you want a thicker vertical line, you set the color values of the pixels of a group of consecutive columns to the desired color.  Figure 1.2 shows a red line that's a single pixel wide and an orange line that's three pixels wide.  The orange line is actually a very thin rectangle.
Pixel Lines Figure 1.2
So, the location of each pixel is obviously specified by a pair of numbers; what about the pixel's color?
Well... a pixel's color is also specified as numbers, three of them, called RGB (Red, Green, Blue) values.  Play with the following Java applet which lets you see what number values generate which colors.  What color do you get if you set red to 170, green to 85, and blue to 255?  What's the RGB value for your favorite color?

Ei kommentteja:

Lähetä kommentti