mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-12 07:53:53 +00:00
Add Altas class & refactored Atlas editor
This commit is contained in:
@@ -5,7 +5,9 @@ namespace PckStudio.Core.Extensions
|
||||
{
|
||||
public static class AnimationExtensions
|
||||
{
|
||||
public static Image CreateAnimationImage(this Animation animation)
|
||||
public static Image CreateAnimationImage(this Animation animation) => animation.CreateAnimationImage(Color.Black);
|
||||
|
||||
public static Image CreateAnimationImage(this Animation animation, Color blendColor)
|
||||
{
|
||||
if (animation.FrameCount == 0)
|
||||
{
|
||||
@@ -15,7 +17,8 @@ namespace PckStudio.Core.Extensions
|
||||
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);
|
||||
Image texture = (blendColor == Color.Black || blendColor == Color.White) ? frame.Texture : frame.Texture.Blend(blendColor, BlendMode.Multiply);
|
||||
generateor.AddFrame(texture, frame.Ticks * GameConstants.GameTickInMilliseconds, GifQuality.Bit8);
|
||||
}
|
||||
ms.Position = 0;
|
||||
return Image.FromStream(ms);
|
||||
|
||||
Reference in New Issue
Block a user