Menge Posted July 20, 2003 Posted July 20, 2003 i need to render a scene and get that rendered scene to a bitmap image keeping the alpha channels. how can i do this? anyone got any ideas other than the GetFrontBuffer Method which is extremely slow? i need to get a Bitmap object specifically. please help! Quote Menge
*Experts* Nerseus Posted July 21, 2003 *Experts* Posted July 21, 2003 You can use GetDC for any surface (if I remember right). Then you can use the API to easily blt the contents to a Bitmap object. Haven't tried it, but it seems easy (in theory). :) -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Menge Posted July 22, 2003 Author Posted July 22, 2003 just remember... that's not viable. to do that, then i'll just take a screenshot.... i want the rendered scene... correctly..... with all the alpha channels too.. i want directx to do it... not windows api which sucks Quote Menge
Menge Posted August 3, 2003 Author Posted August 3, 2003 Nerseus, i've taken a look at the GetDC method... and it does not work on A8R8G8B8 surfaces. i really need the alpha channel. i've talked to a friend of mine who did something similar in C++, and he used the LockRect method. i've used it and have successfully loaded into a GraphicsObject the image. my problem now is transferring it to a bitmap. i tried going through the bitmap and using the SetPixel method. but it's just Painfully slow to: 1) read 4 bytes from the GraphicsStream for every pixel 2) set the pixel on the bitmap. is there any other way to copy the memory data from the GraphicsStream to a Bitmap? Quote Menge
AndreRyan Posted August 3, 2003 Posted August 3, 2003 This might be pointing towards what you want http://www.xtremedotnettalk.com/t74789/s.html It creates a Bitmap from an array of graphical data Quote .Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
Menge Posted August 3, 2003 Author Posted August 3, 2003 (edited) hrm AndreRyan, that looks somewhat different from what i've seen around. i've taken a look at it, and it doesn't work for me either. it's faster.... twice as fast, i mean... but... just not quite it... i managed to do this: Microsoft.DirectX.Direct3D.GraphicsStream Image=front.LockRectangle(LockFlags.None); Bitmap b=new Bitmap(this.Width, this.Height, this.Width*4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, Image.InternalData); the first part is blazing fast. but the bitmap creation one is slow takes about 1 second per frame on my 900Mhz... do any of you guys know how to create a blank bitmap and then simply make it use the GraphicsStream.InternalData as its scan0? they are the same type (the code above works) and all needed was to make the bitmap read from there. not copy as this seems to be going... but just read. this is frustrating :P Edited August 3, 2003 by Menge Quote Menge
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.