|
|
|
@ -19,6 +19,7 @@ public abstract class ImageElementBase : GraphicsElement, IDisposable |
|
|
|
private readonly List<double> _frameDelays = []; |
|
|
|
private readonly List<double> _frameDelays = []; |
|
|
|
private readonly List<SKBitmap> _scaledFrames = []; |
|
|
|
private readonly List<SKBitmap> _scaledFrames = []; |
|
|
|
private double _animatedDurationSeconds; |
|
|
|
private double _animatedDurationSeconds; |
|
|
|
|
|
|
|
private ushort _repeatCount; |
|
|
|
|
|
|
|
|
|
|
|
private Image _sourceImage; |
|
|
|
private Image _sourceImage; |
|
|
|
|
|
|
|
|
|
|
|
@ -83,6 +84,11 @@ public abstract class ImageElementBase : GraphicsElement, IDisposable |
|
|
|
horizontalMargin, |
|
|
|
horizontalMargin, |
|
|
|
verticalMargin); |
|
|
|
verticalMargin); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_sourceImage.Metadata.DecodedImageFormat == GifFormat.Instance) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_repeatCount = _sourceImage.Metadata.GetFormatMetadata(GifFormat.Instance).RepeatCount; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_animatedDurationSeconds = 0; |
|
|
|
_animatedDurationSeconds = 0; |
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < _sourceImage.Frames.Count; i++) |
|
|
|
for (var i = 0; i < _sourceImage.Frames.Count; i++) |
|
|
|
@ -161,6 +167,11 @@ public abstract class ImageElementBase : GraphicsElement, IDisposable |
|
|
|
return _scaledFrames[0]; |
|
|
|
return _scaledFrames[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_repeatCount > 0 && timestamp.TotalSeconds >= _animatedDurationSeconds * _repeatCount) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return _scaledFrames.Last(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double currentTime = timestamp.TotalSeconds % _animatedDurationSeconds; |
|
|
|
double currentTime = timestamp.TotalSeconds % _animatedDurationSeconds; |
|
|
|
|
|
|
|
|
|
|
|
double frameTime = 0; |
|
|
|
double frameTime = 0; |
|
|
|
|