开发者

Efficient bitmap manipulation in WPF (C#)

开发者 https://www.devze.com 2023-01-14 01:23 出处:网络
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

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 t开发者_如何学Pythonhen 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号