mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-29 10:24:34 +00:00
Move Common functionality to Core project & rendering and Model support as well
This commit is contained in:
37
PckStudio.Core/Extensions/ImageSection.cs
Normal file
37
PckStudio.Core/Extensions/ImageSection.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user