views:

34

answers:

1

Hi there,

the problem is as follows:

I have got a rendered bitmap in a byte array (together with the bitmap header). Now I want to manipulate the content of a bitmap. For that purpose I need to wrap this array with some high-level class, say BitmapImage . I want to avoid copying the array, or its data part etc. I want just to force .NET to interpret my byte array as the BitmapImage .

I want to change the content by rendering some stuff to RenderTargetBitmap , and then interpret its data bits as the bits of my image. For rendering I am to use standard DrawingContext, DrawingVisual pair. Thus, it would be great if I could WORK on the data part of my byte array and render my final image to this subarray. Then I did not need to perform any copying and the performance would be great.

How to speedup the calculation and get breathtaking results? :-)

Thank you in advance for the replies!

Cheers

+1  A: 

I would use Writeablebitmap , manipulate it in the code and then show it in the Image. Depending on the context some caching could do a great job.

lukas
Yup, I thought of WriteableBitmap, but how to render some DrawingVisual to that, without copying any data back and forth? I would like to avoid copying for performance reasons... What would you suggest?
Jamie
As far I know it is not possible without copying. May I ask what would you like to achieve? You want to merge DrawingVisual (vector graph) with an image? Maybe you can place it on top of that image (use Canvas Zindex for instance) so it will look like one image
lukas
@lukas - Yes, I want to merge DrawingVisual with an image (which I currently have as the byte array)...
Jamie