Hello
I would like to create the Bitmap from BitmapSource Collection and Each source source should be one frame.
I wrote the following code
MemoryStream memStream = new MemoryStream();
BitmapEncoder enCoder = new GifBitmapEncoder();
foreach (BitmapSource source in BitmapSources)
enCoder.Frames.Add(BitmapFrame.Create(source));
enCoder.Save(memStream);
_Bitmap = new DrawingCtrl.Bitmap(memStream);
DrawingCtrl.ImageAnimator.Animate(_Bitmap, OnFrameChanged);
and
private void OnFrameChangedInMainThread()
{
DrawingCtrl.ImageAnimator.UpdateFrames(_Bitmap);
Source = GetBitmapSource(_Bitmap);
InvalidateVisual();
}
But it shows "Exception has been thrown by the target of an invocation."
. Could anyone help me?