mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-24 06:46:47 +00:00
Splited ImageLayoutDirection and ImageSection into their own files
This commit is contained in:
@@ -9,47 +9,8 @@ using System.Linq;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
internal enum ImageLayoutDirection
|
||||
{
|
||||
Horizontal,
|
||||
Vertical
|
||||
}
|
||||
|
||||
internal static class ImageExtensions
|
||||
{
|
||||
private struct ImageSection
|
||||
{
|
||||
public readonly Size Size;
|
||||
public readonly Point Point;
|
||||
public readonly Rectangle Area;
|
||||
|
||||
internal ImageSection(Size sectionSize, int index, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
switch(layoutDirection)
|
||||
{
|
||||
case ImageLayoutDirection.Horizontal:
|
||||
{
|
||||
Size = new Size(sectionSize.Height, sectionSize.Height);
|
||||
Point = new Point(index * sectionSize.Height, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case ImageLayoutDirection.Vertical:
|
||||
{
|
||||
Size = new Size(sectionSize.Width, sectionSize.Width);
|
||||
Point = new Point(0, index * sectionSize.Width);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Size = Size.Empty;
|
||||
Point = new Point(-1, -1);
|
||||
break;
|
||||
}
|
||||
Area = new Rectangle(Point, Size);
|
||||
}
|
||||
}
|
||||
|
||||
internal static Image GetArea(this Image source, Rectangle area)
|
||||
{
|
||||
Image tileImage = new Bitmap(area.Width, area.Height);
|
||||
|
||||
8
PCK-Studio/Extensions/ImageLayoutDirection.cs
Normal file
8
PCK-Studio/Extensions/ImageLayoutDirection.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
internal enum ImageLayoutDirection
|
||||
{
|
||||
Horizontal,
|
||||
Vertical
|
||||
}
|
||||
}
|
||||
37
PCK-Studio/Extensions/ImageSection.cs
Normal file
37
PCK-Studio/Extensions/ImageSection.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Drawing;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
struct ImageSection
|
||||
{
|
||||
public readonly Size Size;
|
||||
public readonly Point Point;
|
||||
public readonly Rectangle Area;
|
||||
|
||||
internal ImageSection(Size sectionSize, int index, ImageLayoutDirection layoutDirection)
|
||||
{
|
||||
switch(layoutDirection)
|
||||
{
|
||||
case ImageLayoutDirection.Horizontal:
|
||||
{
|
||||
Size = new Size(sectionSize.Height, sectionSize.Height);
|
||||
Point = new Point(index * sectionSize.Height, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case ImageLayoutDirection.Vertical:
|
||||
{
|
||||
Size = new Size(sectionSize.Width, sectionSize.Width);
|
||||
Point = new Point(0, index * sectionSize.Width);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Size = Size.Empty;
|
||||
Point = new Point(-1, -1);
|
||||
break;
|
||||
}
|
||||
Area = new Rectangle(Point, Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,6 +167,11 @@
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Classes\ToolboxItems\PictureBoxWithInterpolationMode.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Extensions\ImageLayoutDirection.cs" />
|
||||
<Compile Include="Extensions\ImageSection.cs" />
|
||||
<Compile Include="Extensions\ListExtensions.cs" />
|
||||
<Compile Include="Internals\ApplicationBuildInfo.cs" />
|
||||
<Compile Include="Classes\API\PCKCenter\model\PCKCenterJSON.cs" />
|
||||
@@ -462,9 +467,6 @@
|
||||
<Compile Include="Forms\Utilities\TextureConverterUtility.Designer.cs">
|
||||
<DependentUpon>TextureConverterUtility.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Classes\ToolboxItems\InterpolationPictureBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="PckNodeSorter.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Forms\Additional-Popups\CreditsForm.cs">
|
||||
|
||||
Reference in New Issue
Block a user