1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
using (surface = device.GetRenderTarget(0))
{
using (surface2 = Surface.CreateOffscreenPlain(device, surface.Description.Width, surface.Description.Height, surface.Description.Format, SlimDX.Direct3D9.Pool.SystemMemory))
{
device.GetRenderTargetData(surface, surface2);
using (Stream tmpStream = Surface.ToStream(surface2, ImageFileFormat.Bmp, new Rectangle(0, 0, surface.Description.Width, surface.Description.Height))
using (Bitmap BmpTmp = new Bitmap(tmpStream))
{
if (BmpX != null)
{
BmpX.Dispose(); //liberation du vieux BmpX
BmpX = null;
}
BmpX = new Bitmap(BmpTmp); //Cree vraiment une image, a partir des donnes de l'ancienne
} //liberation de BmpTmp et tmpStream
} //liberation de surface2
} //liberation de surface |
Partager