Hi,
i was wondering how to display an image to screen using c++. Which would be the best way to go about doing this, any help would be great.
Thanks.
This is a discussion on Displaying an Image with C++ within the C++ Programming forums, part of the General Programming Boards category; Hi, i was wondering how to display an image to screen using c++. Which would be the best way to ...
Hi,
i was wondering how to display an image to screen using c++. Which would be the best way to go about doing this, any help would be great.
Thanks.
In times of war, shoot!
There isn't a "standard library" way to do that. You will have to either use system specific functions (e.g. Windows API calls) or use a third party library [wxWidgets comes to mind, but I'm no expert at that].
So we would need to know if you are using Windows or some form of Unix (or some other OS perhaps). Which compiler you are using would also be useful.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Thanks,
I will be using Windows XP, i like to use Visual C++ Express to do my development. So i guess looking at the Windows API is probably a good place to start.
In times of war, shoot!
Ok, so you will first of all need to create a simple window. On top of that, you will have to load the bitmap (using for example LoadImage()), and then use a BitBlt() function to draw the image to the window.
If you haven't got a book that describes how to do Windows programming, I would suggest that you get one - Charles Petzold (I think that's the correct spelling) have good reputation when it comes for writing books on Windows programming. There are dozens of other good authors too.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Thanks for your help.
Much appreciated .
In times of war, shoot!
Suggest you load that bitmap and keep it open as long as your program is running. If the window needs repainting, it's much, much faster to redraw a bitmap you have loaded rather than reloading the bitmap and drawing it.
Consider it an advice.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Greets,
I would like to "Open/display/write transparent .png win32 api"
in "C" Source. Is there maybe a snippet for this?
Thanks a gig...vmars316
Do not bother with WinAPI.
You cannot just "display it". You will need to have a form processing events, etc. You can use wxWidgets (it is free), but if you are targetting Windows you can use MFC (I am not expert at Visual Studio).
I never put signature, but I decided to make an exception.
In C? Then why are you posting in the C++ forum, then? Unless I am misunderstanding something, that is.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^