tags:

views:

245

answers:

2

Hello everyone,

I have a visualizing module for 2D vector graphics. All calls to drawing API are strictly isolated there. I want to be able replace one drawing API with another drawing API just by reimplementing the module. All data for visualizing are transmitted into the module through a single interface named Ixxx. I have a choice between GDI+ (via WinForms) and WPF, so why should I choose the last one? Any reason?

After some analysis of common cases of switching to WPF among friends, I have found that the primary causes are:

  1. WPF is newer/cooler/more modern/more interesting/blah-blah-blah.
  2. Ixxx is not designed abstract enough (for instance, raw XAML is transmitted) or it doesn't exist at all (any module draws anything, anywhen and the way it wants). Sure, if you have no own graphical description solution, it's better to use XAML than to use nothing and to share common HDC.

Again, I'm not going to "sell my soul" (see AJ&TZ for details) to any given API, I'd like just "to lease it" temporary. It means no using API for anything except drawing all data in the same place.

Regards, Serge.

+3  A: 
  • WPF was designed for vector graphics. GDI+ is meant for raster graphics.
  • WPF will use your computer's graphics processor. GDI+ will do everything in the CPU.
  • WPF has a brand new API with an emphasis ease of use. GDI+ is ancient (Windows 3.x days) and focused on performance for what we now consider extremely low-power hardware.
  • WPF has a brand new API that most of us don't understand. Everyone knows how to use GDI+.
  • Learn 2D WPF and you have a foundation for 3D WPF. After GDI+ you need to start over with Direct3D.

Note: I am not a graphics person, I write business applications. This is mostly based on marketing literature and little test programs.

Jonathan Allen
"GDI+ will do everything in the CPU." Is it really true? I used to think any modern video card (since ancient Matrox's) accelerates GDI+. No pro's or contra's have been found: it looks like today just noone is interested in GDI+ acceleration at all. Anyway, thanks, I'm going to read more about WPF acceleration, especially that is related to glyphs rendering (Achilles' heel of drawing engines!).
noober
"After GDI+ you need to start over with Direct3D". That doesn't matter, I guess, since I'm familiar enough with D3DIM (8). But if I even was not at all, the question is about [hypotetical] WPF's advantage for a project success (based on 2D module quality), not for a programmer education.
noober
To the best of my (very limited) knowledge, GDI+ simply wasn't written with modern video cards in mind. Remember, these APIs date back to the Windows 3.1 days.
Jonathan Allen
+2  A: 

WPF graphics are hardware accelerated. I would consider that a critical consideration. It is a very flexible API for 2D graphics and has a good online community.

This library could be worth a look for you to see what WPF can do: http://dynamicdatadisplay.codeplex.com/

AndrewS