views:

283

answers:

5

I am trying to build a raster drawing application using C# and so far I have not been able to locate any versatile light weight 2D graphics frameworks, or guides.

I was hoping a few of you would be able to give me a good head start because currently my choices are using GDI+ or WPF and that is about it :(...

Basically I need something simple that will provide me with the ability to create a Canvas, Layers, Brushes, and the ability to import/export all of these things. I have looked through several graphic applications to see how they implemented their tools and looked online for books and have come out with no knowledge about where to begin.

Thank You, Andrew

+2  A: 

Well, two things.

One, you can take a look at Paint.Net. It is a free .Net program for working with 2D Graphics. Using the plugin model, you may be able to solve whatever problem you are working on more easily.

Second, a good 2D graphics library is SDL.Net. It's a set of OO wrappers for the C SDL library, and makes drawing 2D images pretty easy. I don't know if it will offer support for all of the more "manipulation" questions you have, though.

Chris
+3  A: 

You don't mention if you want to make a vector editor or a raster editor. I'm assuming raster.

If you don't have much graphics API experience, and just want to get something working as soon as possible, just go with GDI+. It is much simpler than WPF conceptually.

Both GDI+ and WPF can do what you want. Working with WPF will probably give better performance because it uses Direct-X for acceleration. It also uses a stored-scene paradigm, which may make a lot of drawing operations conceptually simpler. The learning curve is much higher than GDI+, though.

You could always use Open-GL, Direct-X, or unmanaged GDI. They all have good 2D performance. But you will have to make calls to unmanaged code.

PeterAllenWebb
Thank you, I did mean raster, updated my post accordingly. I have some time on the matter, I am out doing research before I dive in. I have used GDI+ before, and I had to hack a lot of it to get rid of flickering and annoyances that it posed so I am afraid to make a graphics application on top of it.
Andrew
Well I guess, WPF or Unmanaged GDI are my only two choices thanks :)
Andrew
A: 

If you are trying to learn 2D graphics, WinForms is much easier to learn than WPF. WinForms supports brushes, canvases, multiple graphics formats, file import/export, and such.

The Code Project site has many WinForms graphics tutorials, try starting here.

Dour High Arch
A: 

The XNA framework is easy use and performs well since it is actually just a wrapper for DirectX. The big advantage is that you can write all your code in managed C#. Have a look at this post on the xna forum to see how you can read out the display for export.

Wouter
A: 

There is also the Tao framework, which allows you to use either OpenGL or SDL for your drawing needs. It also is a set of OO wrappers around each. There are quite a few tutorials out there on Google for getting started as well.

Tao Framework

espais