1
0
mirror of synced 2025-01-19 01:14:08 +01:00

Improe channel import/replacer

This commit is contained in:
KillzXGaming 2019-05-17 15:50:03 -04:00
parent cd721af0eb
commit 2c265c876d
8 changed files with 27 additions and 3 deletions

Binary file not shown.

View File

@ -181,10 +181,34 @@ namespace Switch_Toolbox.Library.Forms
if (Image != null)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.FileName = Text;
ofd.Filter = "Supported Formats|*.dds; *.png;*.tga;*.jpg;*.tiff|" +
"Microsoft DDS |*.dds|" +
"Portable Network Graphics |*.png|" +
"Joint Photographic Experts Group |*.jpg|" +
"Bitmap Image |*.bmp|" +
"Tagged Image File Format |*.tiff|" +
"All files(*.*)|*.*";
if (ofd.ShowDialog() == DialogResult.OK)
{
Bitmap ChannelDest = new Bitmap(ofd.FileName);
Bitmap newImage = BitmapExtension.ReplaceChannel(Image, ChannelDest, ChannelType);
Bitmap ImportedImage = null;
string ext = Utils.GetExtension(ofd.FileName);
if (ext == ".dds")
{
DDS dds = new DDS(ofd.FileName);
ImportedImage = dds.GetBitmap();
}
else if (ext == ".tga")
{
ImportedImage = Paloma.TargaImage.LoadTargaImage(ofd.FileName);
}
else
{
ImportedImage = new Bitmap(ofd.FileName);
}
Bitmap newImage = BitmapExtension.ReplaceChannel(Image, ImportedImage, ChannelType);
imageEditor.SaveAndApplyImage(newImage, true);
}
}

View File

@ -579,7 +579,7 @@ namespace Switch_Toolbox.Library
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = Text;
sfd.DefaultExt = "bftex";
sfd.DefaultExt = "dds";
sfd.Filter = "Supported Formats|*.dds; *.png;*.tga;*.jpg;*.tiff|" +
"Microsoft DDS |*.dds|" +
"Portable Network Graphics |*.png|" +