Move Common functionality to Core project & rendering and Model support as well

This commit is contained in:
miku-666
2025-09-01 23:03:39 +02:00
parent 698056a0a0
commit 9656c8b48d
177 changed files with 5979 additions and 1279 deletions

View File

@@ -0,0 +1,24 @@
using System.Drawing;
using AnimatedGif;
namespace PckStudio.Core.Extensions
{
public static class AnimationExtensions
{
public static Image CreateAnimationImage(this Animation animation)
{
if (animation.FrameCount == 0)
{
return null;
}
var ms = new System.IO.MemoryStream();
var generateor = new AnimatedGifCreator(ms, GameConstants.GameTickInMilliseconds, 0);
foreach (Animation.Frame frame in animation.GetInterpolatedFrames())
{
generateor.AddFrame(frame.Texture, frame.Ticks * GameConstants.GameTickInMilliseconds, GifQuality.Bit8);
}
ms.Position = 0;
return Image.FromStream(ms);
}
}
}