Friday, January 15, 2010

WPF Official Image Interop

I got some ideas from here. I ended up solving the problem by creating a new bitmap source each time I received a callback. This seems pretty ridiculous and wasteful, but it was the only way I could get the image to redraw. Note that I couldn't put it inside my callback, because that would have the callback thread doing work with managed variables. I don't get why it raises an exception, because within the callback I do a Marshal.Copy between my unmanaged image data and a managed array, but hey, at least it's working. Does anybody else feel like there must be a better way to do this than to create a new managed object every frame?!

No comments:

Post a Comment