1
0
mirror of synced 2024-11-12 02:00:50 +01:00

Add option to export individual texture channels as a bitmap file.

This commit is contained in:
KillzXGaming 2020-05-05 17:34:18 -04:00
parent 113573b408
commit 32be289855
4 changed files with 35 additions and 6 deletions

View File

@ -372,7 +372,7 @@
// exportToolStripMenuItem
//
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.exportToolStripMenuItem.Size = new System.Drawing.Size(108, 22);
this.exportToolStripMenuItem.Text = "Export";
this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click);
//
@ -621,14 +621,14 @@
// gammaFixToolStripMenuItem
//
this.gammaFixToolStripMenuItem.Name = "gammaFixToolStripMenuItem";
this.gammaFixToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.gammaFixToolStripMenuItem.Size = new System.Drawing.Size(158, 22);
this.gammaFixToolStripMenuItem.Text = "Gamma Correct";
this.gammaFixToolStripMenuItem.Click += new System.EventHandler(this.gammaFixToolStripMenuItem_Click);
//
// stContextMenuStrip3
//
this.stContextMenuStrip3.Name = "stContextMenuStrip3";
this.stContextMenuStrip3.Size = new System.Drawing.Size(61, 4);
this.stContextMenuStrip3.Size = new System.Drawing.Size(181, 26);
//
// ImageEditorBase
//

View File

@ -740,7 +740,7 @@
<value>17, 17</value>
</metadata>
<metadata name="stContextMenuStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>448, 17</value>
<value>448, 21</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>108</value>

View File

@ -37,6 +37,7 @@
this.tabPage1 = new System.Windows.Forms.TabPage();
this.stChannelToolstripMenu = new Toolbox.Library.Forms.STContextMenuStrip(this.components);
this.replaceChannelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportChannelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stTabControl1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tabPage1.SuspendLayout();
@ -49,6 +50,7 @@
this.channelListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.ChannelsColumn});
this.channelListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.channelListView.HideSelection = false;
this.channelListView.Location = new System.Drawing.Point(3, 3);
this.channelListView.Name = "channelListView";
this.channelListView.OwnerDraw = true;
@ -113,17 +115,25 @@
// stChannelToolstripMenu
//
this.stChannelToolstripMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exportChannelToolStripMenuItem,
this.replaceChannelToolStripMenuItem});
this.stChannelToolstripMenu.Name = "stChannelToolstripMenu";
this.stChannelToolstripMenu.Size = new System.Drawing.Size(163, 26);
this.stChannelToolstripMenu.Size = new System.Drawing.Size(181, 70);
//
// replaceChannelToolStripMenuItem
//
this.replaceChannelToolStripMenuItem.Name = "replaceChannelToolStripMenuItem";
this.replaceChannelToolStripMenuItem.Size = new System.Drawing.Size(162, 22);
this.replaceChannelToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.replaceChannelToolStripMenuItem.Text = "Replace Channel";
this.replaceChannelToolStripMenuItem.Click += new System.EventHandler(this.replaceChannelToolStripMenuItem_Click);
//
// exportChannelToolStripMenuItem
//
this.exportChannelToolStripMenuItem.Name = "exportChannelToolStripMenuItem";
this.exportChannelToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.exportChannelToolStripMenuItem.Text = "Export Channel";
this.exportChannelToolStripMenuItem.Click += new System.EventHandler(this.exportChannelToolStripMenuItem_Click);
//
// ImagePropertiesEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -149,5 +159,6 @@
private STPropertyGrid stPropertyGrid1;
private STContextMenuStrip stChannelToolstripMenu;
private System.Windows.Forms.ToolStripMenuItem replaceChannelToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportChannelToolStripMenuItem;
}
}

View File

@ -270,6 +270,24 @@ namespace Toolbox.Library.Forms
}
}
private void exportChannelToolStripMenuItem_Click(object sender, EventArgs e)
{
int ChannelIndex = channelListView.SelectedIndices[0];
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Supported Formats|*.png;*.tga;*.jpg;*.tiff|" +
"Portable Network Graphics |*.png|" +
"Joint Photographic Experts Group |*.jpg|" +
"Bitmap Image |*.bmp|" +
"Tagged Image File Format |*.tiff|" +
"All files(*.*)|*.*";
sfd.FileName = imageEditor.ActiveTexture.Text + $"_{(STChannelType)(ChannelIndex - 1)}";
if (sfd.ShowDialog() == DialogResult.OK) {
imageEditor.GetActiveImage().Save(sfd.FileName);
}
}
private void stPropertyGrid1_Load(object sender, EventArgs e)
{