mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-22 22:35:28 +00:00
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System.Drawing;
|
|
|
|
namespace PckStudio.Core.Extensions
|
|
{
|
|
internal struct ImageSection
|
|
{
|
|
public readonly Size Size;
|
|
public readonly Point Point;
|
|
public readonly Rectangle Area;
|
|
|
|
internal ImageSection(Size originalSize, int index, ImageLayoutDirection layoutDirection)
|
|
{
|
|
switch(layoutDirection)
|
|
{
|
|
case ImageLayoutDirection.Horizontal:
|
|
{
|
|
Size = new Size(originalSize.Height, originalSize.Height);
|
|
Point = new Point(index * originalSize.Height, 0);
|
|
}
|
|
break;
|
|
|
|
case ImageLayoutDirection.Vertical:
|
|
{
|
|
Size = new Size(originalSize.Width, originalSize.Width);
|
|
Point = new Point(0, index * originalSize.Width);
|
|
}
|
|
break;
|
|
|
|
default:
|
|
Size = Size.Empty;
|
|
Point = new Point(-1, -1);
|
|
break;
|
|
}
|
|
Area = new Rectangle(Point, Size);
|
|
}
|
|
}
|
|
}
|