Monday, September 6, 2010

Window(s) Management/Rendering

There is so much to learn about this subject, but this post is only aimed at how the basic desktop graphics are rendered. First, a minimalist approach to graphics, the monowidth font. If your lazy, or it's the 80's, this is how you do graphics. This style still lives on in command prompt, and looks like this: cd ~/Documents/Project/ 

All the letters are the same size, thus making the screen modular, but this really has nothing to do with rendering windows. And now, how do we get color, well, like everything else in a computer, with 1s and 0s. So to get 16 colors, which is the lowest standard, it takes 4-bit color, which is 4 1s and 0s, because 2 to the 4th power is 16. Then there is 8-bit color, which gives 256 options, for simplicity i'll skip to 24-bit, which gives 8 bits for each of the primary colors. So that means 256 red x 256 yellow x 256 blue = 16.8 million options. It doesnt stop there though, next up is 32 bit. 32 bit doesn't add more colors, it adds a secondary 8 bit channel for transparency data. This is what allows all the cool visual effects in Windows Vista and Windows 7.


Now for how the desktop is rendered, obviously all this stuff on color is incorporated here but what's is important is more conceptual than mechanical. All Windows desktops rendered pretty much the same from Windows 95 to Windows XP. Here is a sample:

You assume that behind the start menu and the my computer window is some blue. You would be wrong. This desktop is completely 2D, and so there is NOTHING behind them. This means that each time you drag a window around the computer has to figure out what should've been behind it. Most of the time it is quick enough, but sometimes it can't keep up and you get this:

I know that is vista, but the 'aero' transparency is turned off, so it acts like xp. 


Well that is unacceptable, which is why vista and 7 have transparency effects and improved rendering via a process called dwm.exe. This stands for Desktop Windows Manager, and it renders everything, even if it is hidden behind a window, this allows awesome transparency effects, like this:



If you have any questions, please ask them in the comments. Also, give suggestions for future posts.

No comments:

Post a Comment