Gdi Guidance required - c#

I am currently working in C# with wpf, I don't know about graphics, I want to learn about GDI and graphics from scratch, Can anyone help me by providing some basic knowledge or material?
Can anyone tell me to write very first program using Gdi?

If you want to learn about WPF I really suggest "Windows Presentation Foundation Unleashed"
http://www.amazon.com/Windows-Presentation-Foundation-Unleashed-WPF/dp/0672328917
Also check out this video from the PDC - Mastering WPF Graphics and beyond:
http://microsoftpdc.com/Sessions/CL31
And if you still want to check out GDI you should read this book
http://www.amazon.com/NET-Game-Programming-DirectX-9-0/dp/1590590511/ref=sr_1_1?ie=UTF8&s=books&qid=1259061198&sr=1-1
It starts out with GDI+ basics and then moves on to DirectX.
Even though it's written for VB.NET you'll get a great deal out of it as a c# developer as well. It helped me back in the days and writing the games in the book is just downright fun :p
(Hint: There is a huge performance issue with the first example in the book, try to solve it, it'll help you understand things even better).

I would advise you to take a look at the msdn, usually they have the best resource on the web. Also some tutorial website like code-project.com might help.

Related

How to use SlimDX inside a WPF C# application

i'm totally new to SlimDX and WPF, but i need to create a multiple images in my application and one of them need to be a 3d visualizator of a point render, something like this:
http://img600.imageshack.us/img600/5879/6a00d83452464869e2017ee.gif
I found i can use SlimDX to use DirectX by C# instruction in my application, writing the result in a D3DImage component.
After some tries i made visual studio 2012 to recoignize that D3DImage (for some reason i needed to restart windows to made it work) but i don't know a few things:
How i can initialize a DirectX window inside that D3DImage? I really can't find any example or source code. All the examples i can find (like the 3 litte examples on SlimDX) are out of the WPF context
Where i can find some good documentation about SlimDX? The GameDev community seems some kinda bugged and i can't post anything (maybe because i'm not paying) and i can't find anything anywhere! How i'm supposed to learn that?
Not a single one of the SlimDX examples from the SVN can compile. I always got some reference error with the SlimDX library (empty path) and even re-importing from the correct path doesn't solve it
This is driving my crazy D:
I feel your pain. I haven't be working to much with the D3D stuff in SlimDX for lack of a reason to do so, But I have been playing around with DirectSound and DirectInput, So i'll tell you what i've figured out.
First Bullet:
I'm not sure initializing a D3D Window inside of an image is going to work. If you're using Windows Forms as your base, SlimDX includes a RenderForm or some such thing that subclasses Windows.Forms, and provides a decent amount of functionality. I still haven't figured it out for WPF, even though there's supposed to be a sample for that.
Second Bullet: Documentation is difficult to come by. There's some stuff on the site, and some stuff here, but what's really been helpful is the MSDN Reference for DirectX. SlimDX Mirrors the structures pretty well, and you can find out a lot by reading it. It DOES take a bit of conversion, because the DirectX reference is C++.
Third Bullet: Same problem. Never was able to figure out why.
Hope that helps a bit.

Dynamic user-interface, WPF or not?

I'm currently working at a application that helps people understand how to do there job. You can see it as a personal coach that guides them trough all the steps they need to do that no normal person could keep remembering.
In my previous application we had the ability to show the user up to 4 pictures (what proves to be more then enough). The application would load the data and see how many pictures where in every instruction and then sort out the picture in the best fitting way without messing up the scale and resolution of the pictures. This all was done with GDI+ and worked very well.
Ofc, change is something that always happens, my bosses came up with some great ideas. So they want to be able to see movies on the screen, animated gif's, 3D models that can rotate or animate. So I think we had pushed GDI+ to it's limits and it's time to look for something different.
I have heard and readed about WPF but have no experience with it. Is it even possible to do all what I ask in WPF? And what about the old picture-merging thing I wrote, can we also get it done in wpf? I tried to make some things working but I didn't went as smooth as I hoped.
I'm also concerned about the fact that the interface needs to be dynamic, the one moment it should be showing picture with some text above it, the other moment it should be showing another text with a video under it.
I would love to hear some opinions here and if you got some other suggestions I should look into pls tell me. Thnx in advance
PS: If WPF is the choice, should I convince my boss to change to .net 4.0?
Although my answer can be termed subjective, I find WPF better than GDI+ anyday. You can do everything you can in WPF which you have done/could do in GDI+ (apart from pure games/game engines). If you can afford the steep learning curve of WPF, I think it will be better investment as this technology is not going anywhere soon.
As for .Net 4.0, WPF 4.0 does introduces some important functions in 4.0 (specially easing functions for animations) but there is nothing you cannot do without if you are using 3.5. I won't recommend 3.0 though mainly because of performance in animations.
WPF is up to the task, but you could also check other options.
You could go web based, and have either an XBAP (WPF in the browser), or Silverlight/Flash app.
Silverlight/Flash doesn't require that much from the client (to install), and is easily updatable, and both can do the job.

How should I start playing with 3D?

I'm a developer for just about 6 months now, and since I enjoy programming I've started little programs such as encripters, calculators, tools, stuff to play with DropBox (hehe), stuff that play with bitmaps, drawing graphics, and even a program to update the MSN display image according to the artwork of the music you're listening yo on iTunes.
One of my other hobbies is 3d modelling (completely amateur) and I'd like to mix these hobbies together! So I've read a little about it and figured I'd have to have good notions on geometry, math, point spacial position (which I do, from my 3d modelling experience), but I don't know how to use API's for it, so I've 'simulated' simple 3d with a simple program I've made (a spinning cube).
Here are some questions:
1) What would be a nice 3d development tool for a .NET programmer like me?
2) Is there a way of using 3d models made in 3DS Max ? (I intend on modelling characters)
3) What knowledge should I have in order to render it, and move it around ?
4) Which API should I use ?
NOTE: Not a dupe, I'm asking for directions specific for .NET development possibly using 3ds MAX, and there were no questions about it so far
EDIT:
I've got three answers that seem quite nice, so let me specify a little and maybe you can tell me what's the more appropriate tool.
What I'd like to build soon would be like:
portable (click'n'run, no need to install, and (hopefully) no need to send DLL's along)
"3D embedding" in winforms application, like a picturebox you could render in.
Real winforms application-like (having all System api's like IO, Drawing and etc)
The development enviroment would be nice if it:
Had the possibility to import existant 3D models (not a must, but a plus)
Had the ability to create 3d models programatically (a must)
Possibly has a tool for materials and textures (that would be a huge plus)
Is Well known (high availability of tutorials, questions in S.O., forums..)
And it would be really nice if I could use C# all the way :)
I'm going to provide another vote for XNA. The comment that it's too "game centric" is a non-starter - it provides a rendering loop with feedback on how fast everything is running so you can adjust your rendering to try to maintain a specific framerate (if you want). This isn't particularly game-centric as it's something that most 3D applications should worry about. The only thing that's really unusually game-centric about it is that it provides easy access to game controllers. Feel free to ignore that bit if you don't want to use it.
The only downside for you using XNA is your requirement that it be click'n'run, XNA has a redistributable that you have to worry about. Note that Win7 has this installed by default, but Vista and earlier don't.
EDIT:
XNA is made for applications that are strictly 3D. As such it doesn't natively support using typical windowing controls inside of an XNA project. But, there are ways around this...
A few useful links. Embedding XNA in a winform : http://forums.xna.com/forums/p/6471/34180.aspx#34180
WPF controls directly inside an XNA project : http://www.c-sharpcorner.com/UploadFile/iersoy/256/Default.aspx
Personally, I found XNA a little too "Game Centric" for my tastes. I was more interested in design/architecture type uses.
You may find SlimDX more to your liking.
Even though there are great suggestions in this post already(such as SlimDX and XNA), I'd just like to mention OpenTK.
OpenTK is closer to OpenGL than Direct3D, but it might be the best solution for cross-platform 3D .NET applications.
Since you are using C#.Net, the XNA library will be excellent for you. It is free off the Microsoft website and integrates into the VS IDE. A lot of available tutorials around to help get started.
Also, if I remember correctly. to use a 3d model in XNA, simply export the completed model as (.X). It can then be loaded into your work.
I vote you try Blender. www.blender.org
It's free, open source, and has a great community both on forums and IRC. Progress on the app is pushed forward by major community projects every year, some of which are movies and games and have won some awards. It is gaining industry acceptance as a way to model extremely fast.
Downsides: It's not considered as "pro" as Maya or ZBrush, and it has a very different brain about interface. Learning curve can be interesting, depending on how you learn and how much help you receive.
Upsides: It's free, great community, updated regularly, many tutorials and community projects to work on.
Community:
Blender channel on IRC
Blenderartists forums
Previous community Projects:
Elephant's Dream
Big Buck Bunny
My vote goes for Povray. It is a 3d renderer with a c-like syntax language. It doesn't satisfy your .net needs, but if cool non the less for 3d rendering. If you any kind of interactivity XNA is probably your best best. But I'm interested in your finds.
Re: "Has the ability to create 3d models programatically (a must)"
A few pointers:
Polygon Triangulation
(Dr. ?) Jonathan Richard Shewchuk's Triangle library
Dr. Hang Si's TetGen library
Constructive Solid Geometry
GNU Triangulated Surface Library
There are no .NET libraries I am aware of that allow you use the above mentioned libraries/techniques. You will have to use PInvoke or C++/CLI in order to make calls to these libraries from the managed world.

How to implement face recognition in an image in .net 3.5?

I need to implement face recognition like in orkut album.
In my website when a user uploads a photo and checks the photo in album I need to implement the feature and place rectangles over the faces in photo like in orkut album like in this link.
Please help me to implement this.
Thanks in advance.
You need to use OpenCV, or more specifically, a C# wrapper library for OpenCV.
I think you can implement some (very) basic face detection using OpenCVDotNet, although you should be aware that I don't think it's actively being developed. I just noticed I'm still on the list as a project committer, but I haven't done any work on it for a long time (if ever, can't remember why I got added in the first place).
You should probably go with Emgu CV, which is a much better C# wrapper for OpenCV. It is actively developed, and is compatible with OpenCV 2.0, and has a wider community surrounding it, and the documentation is good enough that you can easily get face detection working pretty quickly.

Good little project to do when learning C# WPF

I want to write a little application for myself to learn C# and WPF.
The typical hello world in 2009 (twitter client) seems boring. I would like to hear your stands should I do a twitter client? Any other starters I could play around with and get used to c#? (I'm a longtime PHP programmer)
A Twitter client ends up being a good way to get started with WPF, for a few reasons:
It's got lists of data with images, which gives you practice with formatting and styling lists
There are a lot of options for styling what you're working on - partly due to the avatars, limited text blocks, etc.
A Twitter app is the kind of application where you expect to see good UI
There are some good libraries availble (I highly reccommed tweet#) so you don't need to bother with any of the plumbing
It's something you can show off and be proud of - people will understand what it does
There are plenty of complex things you can add on later if you want - skinning, drag and drop, autocomplete, spell checking, etc.
There are some open source WPF clients out there, so you can find some sample code if you get stuck
And the number 1 reason why it's good idea... you can start contributing your code to the Witty project. We'd love more help!
I recommend to write a native GUI (WPF) client for your most recent PHP project.
You can try writing a modelling tool (business processes flow/UML (classes)/execution flow i.e. scripts execution flow/etc...).
WPF Virtual Labs are a good place to start.
Only do a twitter client if that's what you're interested in. I don't see why twitter should be the new "hello world.", except maybe for making such a thing, like a twitter or facebook bot.
If you want to focus on C# and OOP, try something with many objects interacting, like a simple fighting game, poker, black-jack, etc.
If you want to learn wpf, try some fancy interface stuff, like a calculator, a video player, a photo gallery.
You're only limited to your imagination. Try to pick something fun, or something you'd like your computer to do, and code away. :D

Categories