I'm tryin to do some Aplha blending with directdraw surfaces. I could not figure out how to do it using DirectDraw so I thought maybe I can do it manually.
I tried to copy a portion of the suface into a bitmap object but it does not seem to work.
Here is some code, btw it's in c#
Nothing is being copied to the bitmap, can anyone help?
Is there an easier way of doing this?
I tried to copy a portion of the suface into a bitmap object but it does not seem to work.
Here is some code, btw it's in c#
Code:
//Bitmap to hold the copied data
Image _bitmap = new Bitmap(mPortion.Width, mPortion.Height);
Graphics _g1 = Graphics.FromImage(_bitmap);
IntPtr _dc1 = _g1.GetHdc();
//Get the surface's dc
IntPtr _surfacedc = _surface.GetDc();
IntPtr _dc2 = CreateCompatibleDC(_surfacedc);
//Copy the portion rectangle
BitBlt(_dc1, mPortion.X, mPortion.Y, mPortion.Width, mPortion.Height, _dc2, 0, 0, 0x00CC0020);
//Save the bitmap to test whether anything was copied
_bitmap.Save("bah.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
//Clean
_g1.ReleaseHdc(_dc1);
_surface.ReleaseDc(_surfacedc);
DeleteDC(_dc2);
Nothing is being copied to the bitmap, can anyone help?
Is there an easier way of doing this?