How to make when changing Image Source picture smoothly changed to a new one?
& lt; image grid.row = "0" margin = "10"
Source = "{binding path = currentimage, updatesourcetrigger = propertychanged}" & gt;
& lt; / image & gt;
Public ImageSource CurrentImage.
{
Get.
{
_CurrentImage = NULL;
_CurrentImage = New Bitmapimage (New URI (_Listimageuri [_CurrentIndex]));
Return _CurrentImage;
}
}
Answer 1
Creation:
Bitmap MyBitmap = / * Che thread * /;
New WriteableBitmap (System.Windows.Interop.imaging.createBitmapsourceFromhBitmap (
MyBitmap.GethBitmap (),
INTPTR.ZERO,
Int32Rect.Empty
Bitmapsizeoptions.fromemptyoptions ()));
or
New Bitmapimage (New Bitmapimage ("PACK: // Application :,,, / images / MyImage.png ")));
Overwriting pictures (change):
writeablebitmap wb = / * Suppose here already have data * /;
Bitmap MyBitmap = / * There is a new picture * /;
System.Drawing.imaging.Bitmapdata BMD =.
newbitmap.lockbits (New System.Drawing.Rectangle (0, 0, newBitmap.width, newBitmap.Height),
System.Drawing.imaging.ImageLockMode.Readonly,
System.Drawing.imaging.pixelformat.format32bpppargb);
WB.WritePixels (New int32Rect (0, 0, newBitmap.width - 1, newbitmap.height - 1), bmd.scan0, bmd.stride * bmd.height, bmd.stride);
newbitmap.unlockbits (BMD);
In your case, a new bitmap is a new picture + on top of her drawn old with some transparency. On the trail. We increase transparency. Well, as long as the old picture does not disappear. Piham this logic in the timer.