MULTIMEDIA

Vectors in WPF

7/25/2010 5:11:12 PM
I_sect12_d1e724.html
Most graphics nowadays are pixel-based. Every point in the graphic is represented by one pixel. This is a really good solution for most scenarios, including digital photography (where you really want to maintain every single piece of information the camera is "seeing"), but there are shortcomings too. For instance, have a look at Figure 1, where you see some simple text created in Microsoft Paint. This text is pixel-based. In Figure 2, you see the same text, but this time the image width and height have been enlarged. Do you see the stairway effect that appears along the edge of each letter? So, when you make a pixel-based image larger, you lose quality.

Figure 1. The word "Silverlight" displayed by Paint, a pixel based tool


Figure 2. Increased in size, text in a pixel-based tool displays "stair step" edges


That's obvious, of course. Imagine that a 100 x 100 pixel image is resized to 200 x 200 pixels. Instead of 10,000 pixels, we now have 40,000 pixels. So, where we had a 1 x 1 pixel in the original image, we now have 2 x 2 pixels. Paint is using a very simple algorithm to resize images: if the graphic becomes larger, just clone the pixels. This then creates the stairway effect.

NOTE

Professional software such as Adobe Photoshop comes with several sophisticated algorithms to make the quality loss less severe when resizing images (especially when making them smaller); however, there still is a notable effect when increasing an image's dimensions.

Vectors

There is an alternative approach: vector-based images. In a vector-based image, every element is represented as a geometrical object—for example, a line, a circle, a polygon, or a curve, just to name a few. The main advantage is that there is no quality loss when resizing an image: a circle changes its diameter, but that's all. There is no stairway effect, since a circle is still a circle and not, as with a pixel image, a set of pixels ordered in a circular fashion.

Obviously, not every image can be represented as vectors. Think again of photos—it is theoretically possible to try to find geometrical elements and patterns in a portrait or a landscape (there are even algorithms for that!), but it is virtually impossible to create an exact representation of a photo by just using vectors. However, in computing there are several areas where vectors make real sense. One such area is fonts. See Figure 3 for a typical Windows font (coincidentally the same font used in figures Figure 1 and Figure 2). Most fonts are vectors, so there is no quality difference whether you use them in 8pt, 10pt, 12pt, or 100pt. If you type a letter in a word processor and then change the font size to something really large, you still get smooth edges. Once you paste text into pixel-based imaging software such as Paint, you lose the vector information and are back to pixels.

Figure 3. A vector-based Windows font


Another area prone for vector representation is the user interface (UI). The standardized UIs of an application are, most of the time, vector-compatible. Most of them need to be resizable, so the content can remain intact if the user changes the width or the height of a window. However, in reality, very few UIs have been based on vectors.

Other  
 
Top 10
Smali Form Factor Cases (Part 3) - Silverstone TJ08-E
Smali Form Factor Cases (Part 2) - Cubitek Mini Ice, In-Win BL641
SmallForm Factor Cases (Part 1) - Akasa Crypto Vesa, Cooler Master Elite 120
Portable Drive: WD My Passport Studio 2TB
Portable Led Projector: Benq Joybee GP2
The Tie That Binds
Primer - Movie Formats And Conversion
Adobe's Creative Suite Dreams
Linux Mint 13 - One Of The Best Linux Distros Around
File and Disk Recover And Restore (Part 2) - PC Tools File Recover, Piriform Recuva, Ubuntu Rescue Remix
Most View
70 Ways To Take Better Photos (Part 2) - Improve your vista shots
Buying Guide: Memory Kit (Part 2) - Corsair Dominator GT With DHX Pro Connector, G. Skill RipjawsZ DDR3-2133 & Mushkin Enhanced Redline 16GB DDR3-2133
Asus P8Z68-V Pro
Troubleshooting Startup and Shutdown
Mind Control (Part 2) - Home entertainment & gaming
SQL Server 2008 : Working with DML Queries - Using the MERGE Statement
Server-Side Browser Detection and Content Delivery : Mobile Detection (part 3) - Transcoders
Pandora On Android-Your Best Music Buddy!
Implementing Client Access and Hub Transport Servers : Installing the Client Access Server
iPhone, iPad touch and iPad : Realikety
20 Top Tips Sunrise & Sunset (Part 2)
XtremeMac Portable Speaker Reviews
Buying Guide: CPU Cooling Equipment (Part 3) - NZXT HAVIK 140,Phanteks PH-TC140PE_BL, Swiftech H20-X20 Edge HD
Installing and Maintaining Devices in Vista: The Essentials
Understand Security Improvements in Windows Server 2008
Deploying the Client for Microsoft Exchange Server 2010 : Understanding Deployment Options
Exchange Server 2007 : Configure the Client Access Server - Enable POP3 and IMAP4
Enabling Presence Information in SharePoint with Microsoft Communications Server 2010
Programming .NET Security : Programming Asymmetrical Encryption
Something Spatial