PDA

Click to See Complete Forum and Search --> : Graphics in C++


Sastraxi
Dec 13th, 2001, 07:31 AM
As you might know I've always been pretty good with graphics in VB. Now that I've stepped the line to C++, it's pretty neat but doesn't come without its difficulties. Say I just wanted to load a bitmap, get its bits, and change them without showing the picture. Or anything, really. What would I need to do this?

kedaman
Dec 13th, 2001, 08:05 AM
Same api's you've used in vb, LoadImage, BitBlt, Getpixel, SetPixelv...

btw i recommend you learn the language first, there's whole load of new concepts that you should learn before starting with the api's. Have a look at the faq for tutorials

Sastraxi
Dec 13th, 2001, 02:59 PM
I've read Learning VB5 by that guy with the white toupee hair and glasses 2 times over and I think I understand the whole bit.

Sastraxi
Dec 13th, 2001, 05:45 PM
Okay, so anyways. I want to create a DC and edit it, etc. What you do in VB is create an StdPicture and then use the LoadBitmap command to get it. What I want to know is what the C++ equivalent is.

Zaei
Dec 13th, 2001, 06:51 PM
CreateCompatibleDC(), LoadImage(), etc.

Z.

Sastraxi
Dec 13th, 2001, 07:28 PM
Hmmm. Thanks for that Zaei!

The only thing is I don't know how to declare API calls. I don't even know if I can use them in my console app, but I think I can (WIN32 Console App)

Zaei
Dec 13th, 2001, 08:17 PM
#include <windows.h>

Then just use them as normal. No individual declarations for us =).

Z.

SteveCRM
Dec 13th, 2001, 09:43 PM
you see we tell people C++ is hard, but really we're just lazy so one line declares them all for us :p

Sastraxi
Dec 14th, 2001, 10:19 PM
Wow. Awesome.

Sastraxi
Dec 14th, 2001, 10:26 PM
Just one question- I want to use GetTickCount but I can't seem to get the right type. It won't cast: "cannot convert from 'unsigned long (__stdcall *)(void)' to 'unsigned long'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast"

Zaei
Dec 14th, 2001, 10:54 PM
Have to, Have to, HAVE TO add the parens in functions calls. None of this GetTickCount VB stuff. It has to be GetTickCount(), with nothing in the parens.

Z.