-
GetSurfaceFromDC Problem
Hello i need help
I am using a picturebox to rotate an image and need to place it into a directdrawsurface7 object
I am trying to use the DDraw.GetSurfaceFromDC command with the HDC of the Picturebox and it just wont have it, it comes back with a Automation error
Please what am i doing wrong if it isnt possible to use this then how can i do it??????
Set DSpriteSurfaces(i, LoadC) = DDraw.GetSurfaceFromDC(frmBattle.pbBattle.hDC)
-
I know it has been like a year since you posted this :D
but did you get any result? I can get the function to work :\
-
I never got it working but i did find an alternative. I rotated the image in memory or loaded it from a file (The later being the better) :) :) :)
-
damn, ok
I'll keep playing :D
-
Instead of doing the rotating in the picture box (by no doubt i'm asuming your either using PSet pixel or BitBlt??) do it in the surface once its loaded, or in a OffScreenDC If your using BitBlt to do the editing then it shouldn't be hard to edit you current code. However if you are using the PSet you should be aware that its a slow process to use. If you insist on using the picture box you can create a surface normally then use BitBlt to blt you image from PictureBox.hDC to Surface.GetDC. If you were using the PSet statement look into Locking a surface and editing it pixel by pixel at great speed(compared to PSet Anyway).
Hope all that helps you.
-
im not trying to rotate an object, I've got a pointer to a bitmap and I've been using SetDIBitsToDevice to get the bitmap on a picturebox, works ok but I want it to go on a DirectDrawSurface7 object...
-
Damm I must type really slow:( the two of you have manged to post in the time it took me to write my post. Soz, my thorts are along the lines of BodwadUK, apart from the bit of saving the file and loading it back.:D
-
How about if you do the method I mentioned of setting up the surface seprate by using the height and width then just BitBlt it over??
-
im trying but picbuffer.GetDC keeps giving me automation errors :mad:
-
Have you set this flag??
SurDesc.ddsCaps.lCaps = ... Or DDSCAPS_OWNDC
-
reading my code, I havent even created the surface :P
gonna be a long day