Sign in to follow this  
derby

[SlimDX] - Direct2D Off-screen rendering

Recommended Posts

Hi there, I am pretty new to DirectX and SlimDX and trying with the Sample code provided with the SlimDX. I am trying to render couple of polygons using Direct2D in off-screen mode and stream out the image imagerated. My question is, Is there anyway I can get the byte array of the image rendered from the Target so that I can encode and stream out the image. I am able to do this using Windows API Pack and Windows Image Component. Since our other projects are using SlimDX I would like to stick to it. Below is the part of the code I am trying.
 protected override void OnRender()
        {

            BitmapRenderTarget bmpTarget = Context2D.RenderTarget.CreateCompatibleRenderTarget();
            bmpTarget.BeginDraw();
            foreach (var geometry in _geometryList)
            {
                bmpTarget.FillGeometry(geometry, _brush);
            }

            bmpTarget.EndDraw();

            //How do I get the byte array from bmpTarget and Endcode into a png image.
        }

Thanks in advance.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this