texture to Bitmap...

Sethy

Newcomer
Joined
Oct 29, 2003
Messages
2
Location
Italy
Hi! I want a help to create a bitmap object from a texture!

I created a render target, so the render target is a texture, but now I need to copy the image created in the texture to bitmap to pass to an another step, I tried to get the handle of the texture with no success! please help me with some suggest!

Thank you....
 
I am sorry, I have no idea. I am having a problem just getting the Xsize and Ysize of the texture.. I suspect whoever knows what you are looking for could also answer this.

gl

/Rosecroix
 
hrm... well i have something... set the render target to a surface (here it's "front")

and do this:

Code:
// Locks the surface
Microsoft.DirectX.Direct3D.GraphicsStream ImageStream = front.LockRectangle(dockBg, LockFlags.None);
// Creates the bitmap from the surface internal data
Bitmap MyBitmap = new Bitmap(WIDTH, HEIGHT, WIDTH*BYTES_PER_PIXEL, System.Drawing.Imaging.PixelFormat.Format32bppArgb, ImageStream.InternalData);

// do your stuff with the bitmap

// Dispose the stuff you just used
front.UnlockRectangle();
MyBitmap.Dispose();

that code will get you a bitmap out of a surface... what you can do is, render the texture to the surface and then copy it. it was the fastest way i found in .Net.

hope it helps :)
 
Back
Top