mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-22 01:06:35 +00:00
PckFileDataExtensions - Add SetTexture
This commit is contained in:
@@ -29,7 +29,7 @@ namespace PckStudio.Extensions
|
||||
throw new Exception("File is not suitable to contain image data.");
|
||||
}
|
||||
return file.Get(ImageDeserializer.DefaultDeserializer);
|
||||
}
|
||||
}
|
||||
|
||||
internal static T Get<T>(this PckFileData file, IPckDeserializer<T> deserializer)
|
||||
{
|
||||
@@ -56,7 +56,7 @@ namespace PckStudio.Extensions
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetData(this PckFileData file, Image image, ImageFormat imageFormat)
|
||||
internal static void SetTexture(this PckFileData file, Image image)
|
||||
{
|
||||
if (file.Filetype != PckFileType.SkinFile &&
|
||||
file.Filetype != PckFileType.CapeFile &&
|
||||
@@ -64,12 +64,7 @@ namespace PckStudio.Extensions
|
||||
{
|
||||
throw new Exception("File is not suitable to contain image data.");
|
||||
}
|
||||
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
image.Save(stream, imageFormat);
|
||||
file.SetData(stream.ToArray());
|
||||
}
|
||||
file.SetData(image, ImageSerializer.DefaultSerializer);
|
||||
}
|
||||
|
||||
internal static bool IsMipmappedFile(this PckFileData file)
|
||||
|
||||
@@ -271,7 +271,7 @@ namespace PckStudio.Popups
|
||||
cape.Filename = $"dlccape{skinId}.png";
|
||||
skin.AddProperty("CAPEPATH", cape.Filename);
|
||||
}
|
||||
skin.SetData(skinPictureBox.Image, ImageFormat.Png);
|
||||
skin.SetTexture(skinPictureBox.Image);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
@@ -288,7 +288,7 @@ namespace PckStudio.Popups
|
||||
if (MessageBox.Show(this, "Create your own custom skin model?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
skin.SetData(Resources.classic_template, ImageFormat.Png);
|
||||
skin.SetTexture(Resources.classic_template);
|
||||
|
||||
using generateModel generate = new generateModel(skin);
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@ namespace PckStudio
|
||||
texture = _img;
|
||||
}
|
||||
|
||||
file.SetData(texture, ImageFormat.Png);
|
||||
file.SetTexture(texture);
|
||||
wasModified = true;
|
||||
BuildMainTreeView();
|
||||
}
|
||||
@@ -1437,10 +1437,10 @@ namespace PckStudio
|
||||
PckFile infoPCK = new PckFile(3);
|
||||
|
||||
PckFileData icon = infoPCK.CreateNewFile("icon.png", PckFileType.TextureFile);
|
||||
icon.SetData(Resources.TexturePackIcon, ImageFormat.Png);
|
||||
icon.SetTexture(Resources.TexturePackIcon);
|
||||
|
||||
PckFileData comparison = infoPCK.CreateNewFile("comparison.png", PckFileType.TextureFile);
|
||||
comparison.SetData(Resources.Comparison, ImageFormat.Png);
|
||||
comparison.SetTexture(Resources.Comparison);
|
||||
|
||||
PckFileData texturepackInfo = pack.CreateNewFile($"{res}/{res}Info.pck", PckFileType.TexturePackInfoFile);
|
||||
texturepackInfo.AddProperty("PACKID", "0");
|
||||
@@ -2047,7 +2047,7 @@ namespace PckStudio
|
||||
gfx.DrawImage(originalTexture, tileArea);
|
||||
}
|
||||
|
||||
MipMappedFile.SetData(mippedTexture, ImageFormat.Png);
|
||||
MipMappedFile.SetTexture(mippedTexture);
|
||||
|
||||
currentPCK.InsertFile(currentPCK.IndexOfFile(file) + i - 1, MipMappedFile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user