I'm currently working on a project where I need to render images to the screen.
I have a networking class that exposes an Observable that delivers the images in a Jpeg format byte[]
.
The way I'm currently doing it is converting the byte[]
into a Bitmap and calling Invalidate()
on the form. The image is then painted using e.Graphics.DrawImageUnscaled
function.
The problem is it may get called anywhere from 20 to 100 times per second and creating a new Bitmap
/MemoryStream
and disposing them is ridiculous GC pressure that I'd like to avoid if possible.
What would be some possible solutions to minimize this pressure?
Also, I'm not currently loving GDI and so would like to hear some other options that might increase performance.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…