Raster Graphics

Why Raster Graphics ?

Until approx. 1980 computer graphics was only and exclusively vector graphics. The computer community was inspired of the aesthetics of the fast line movements of the vector displays, which were much more elegant than the thick horizontal TV lines and it appeared absurdly that TV could ever replace the elegant vector pictures of the computers. One did not feel as lack that the vector displays could not fill surfaces and that there was just one color.
On the other hand TV receivers were cheap and popular, vector displays however expensive and exotic. Therefore the computer industry had to use TV to conquer a mass-market. It had to connect a linearly addressed digital machine (the computer) with a surface covering, matrix oriented, analog CRT = TV. This was the birth of an important computer extension, the graphic board, consisting of:
1) fast RAM to store the raster matrix (=digital image memory)
2) fast address generator for the matrix synchronously to the analog H- and V-Sync signals (=video controller)
3) fast digital-to-analog converter (=DAC), which has to convert the matrix figures into analog brightness + color signals
The first raster graphics looked deterring: Mickey Mouse was composed of flickering and clumsy pixels and had roughly jagged ears. The fusion of computer and TV was first a failure. It became clear that useful raster graphics need much better technology than TV i.e. approx. double resolution of space and time.
Under this pressure two new (at first pretty expensive) products emerged: the computer monitor and the graphics board.
Nowadays raster graphics rules the desk top although it has neither thin lines nor curves, which have to be simulated by stairs. It carries enormous redundancy and it's very difficult to write pure raster graphics programs. This is the reason why vector graphics will never die. We desperately need them as back ground data behind all artificial raster graphics (not behind pure photos and videos).

Examples of the definition of a raster matrix M with 32-Bit color pixels = ARGB-pixel:C++ as array : int M[height][width];Java as array : int[][] M = new int[height][width];C# as array : Color[,] M = new Color[height, width];C# as bitmap: Bitmap M = new Bitmap( width, height, PixelFormat.Format32bppArgb );Confusing, but important: All computer languages require to write first the y-coordinatein front of the x-coordinate in 2D raster arrays. Reason: In computers there are no such things as a matrix. Computers just have a linearly addressed memory space and map any matrix into this space. When you want to map the first line (y = 0) first, then you have to write y first. Otherwise the computer maps differently: It stores the fist column first, which is contrary to any intuition.
Consequence: If you want to blacken the mouth of the Homunculus, then write:C++ as array : Homunculus[1][4] = 0;Java as array : Homunculus[1][4] = 0;C# as array : Homunculus[1,4] = Color.Black;C# as bitmap: Homunculus.SetPixel( 4, 1, Color.Black );Linear addressing:A matrix is a pure language construct, because computers know only a linear address schema. Imagine the [y][x]-matrix as a chest of drawers. Inside the main memory the drawers are put on the floor side by side.

In main memory: At first row 0, then row 1 etc. until row height-1.
If you want a pixel M[y][x] from inside, the computer has to find the linear address
M + y * width + x. You pay the comfortable access M[y][x] with 2 additions
and a multiplication.

Annotation to raster rotation:
The Graphics-class of .NET contains an elegant variant of the method DrawImage(...). It accepts a parameter of three verices p[0], p[1] and p[2] which define a parallelogram. DrawImage(...) scales, rotates and shears the raster image to fit the corners of the image to the corners of the parallelogram. You just have to rotate the polygon PointF[] p = new PointF[3];, feed the rotated triangle into DrawImage(myBitmap, p) and the complete raster rotation follows automatically.
See: http://msdn.microsoft.com/library/....
You find such a rotation animation where the vertices of the triangle slide along the window borders here: ../../C_IPCis/C1_Bitmap/CIPCisBitmap_e.htm#a9.