Start to impliment component selectors for textures
This commit is contained in:
parent
489d47243b
commit
9cb712cf12
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -419,6 +419,16 @@ namespace FirstPlugin
|
|||||||
SetChannelComponents();
|
SetChannelComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private STChannelType SetChannel(byte compSel)
|
||||||
|
{
|
||||||
|
if (compSel == 0) return STChannelType.Red;
|
||||||
|
else if (compSel == 1) return STChannelType.Green;
|
||||||
|
else if (compSel == 2) return STChannelType.Blue;
|
||||||
|
else if (compSel == 3) return STChannelType.Alpha;
|
||||||
|
else if (compSel == 4) return STChannelType.Zero;
|
||||||
|
else return STChannelType.One;
|
||||||
|
}
|
||||||
|
|
||||||
private void SetChannelComponents()
|
private void SetChannelComponents()
|
||||||
{
|
{
|
||||||
surface.compSel = new byte[4] { 0, 1, 2, 3 };
|
surface.compSel = new byte[4] { 0, 1, 2, 3 };
|
||||||
@ -429,6 +439,11 @@ namespace FirstPlugin
|
|||||||
if (bitmap == null)
|
if (bitmap == null)
|
||||||
return; //Image is likely disposed and not needed to be applied
|
return; //Image is likely disposed and not needed to be applied
|
||||||
|
|
||||||
|
RedChannel = SetChannel(surface.compSel[0]);
|
||||||
|
GreenChannel = SetChannel(surface.compSel[1]);
|
||||||
|
BlueChannel = SetChannel(surface.compSel[2]);
|
||||||
|
AlphaChannel = SetChannel(surface.compSel[3]);
|
||||||
|
|
||||||
surface.format = (uint)FTEX.ConvertToGx2Format(Format);
|
surface.format = (uint)FTEX.ConvertToGx2Format(Format);
|
||||||
surface.width = (uint)bitmap.Width;
|
surface.width = (uint)bitmap.Width;
|
||||||
surface.height = (uint)bitmap.Height;
|
surface.height = (uint)bitmap.Height;
|
||||||
@ -594,6 +609,7 @@ namespace FirstPlugin
|
|||||||
compSel = reader.ReadBytes(4);
|
compSel = reader.ReadBytes(4);
|
||||||
texRegs = reader.ReadUInt32s(5);
|
texRegs = reader.ReadUInt32s(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] Write()
|
public byte[] Write()
|
||||||
{
|
{
|
||||||
MemoryStream mem = new MemoryStream();
|
MemoryStream mem = new MemoryStream();
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -75,6 +75,7 @@
|
|||||||
this.adjustmentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.adjustmentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.hueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.hueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.brightnessContrastToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.brightnessContrastToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.componentSelector = new Switch_Toolbox.Library.Forms.STCheckBox();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
this.splitContainer1.Panel1.SuspendLayout();
|
this.splitContainer1.Panel1.SuspendLayout();
|
||||||
this.splitContainer1.SuspendLayout();
|
this.splitContainer1.SuspendLayout();
|
||||||
@ -196,6 +197,7 @@
|
|||||||
//
|
//
|
||||||
// stPanel3
|
// stPanel3
|
||||||
//
|
//
|
||||||
|
this.stPanel3.Controls.Add(this.componentSelector);
|
||||||
this.stPanel3.Controls.Add(this.editBtn);
|
this.stPanel3.Controls.Add(this.editBtn);
|
||||||
this.stPanel3.Controls.Add(this.toggleAlphaChk);
|
this.stPanel3.Controls.Add(this.toggleAlphaChk);
|
||||||
this.stPanel3.Controls.Add(this.saveBtn);
|
this.stPanel3.Controls.Add(this.saveBtn);
|
||||||
@ -544,6 +546,19 @@
|
|||||||
this.brightnessContrastToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
|
this.brightnessContrastToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
|
||||||
this.brightnessContrastToolStripMenuItem.Text = "Brightness / Contrast";
|
this.brightnessContrastToolStripMenuItem.Text = "Brightness / Contrast";
|
||||||
//
|
//
|
||||||
|
// componentSelector
|
||||||
|
//
|
||||||
|
this.componentSelector.AutoSize = true;
|
||||||
|
this.componentSelector.Checked = true;
|
||||||
|
this.componentSelector.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||||
|
this.componentSelector.Location = new System.Drawing.Point(174, 7);
|
||||||
|
this.componentSelector.Name = "componentSelector";
|
||||||
|
this.componentSelector.Size = new System.Drawing.Size(144, 17);
|
||||||
|
this.componentSelector.TabIndex = 17;
|
||||||
|
this.componentSelector.Text = "Use Component Selector";
|
||||||
|
this.componentSelector.UseVisualStyleBackColor = true;
|
||||||
|
this.componentSelector.CheckedChanged += new System.EventHandler(this.componentSelector_CheckedChanged);
|
||||||
|
//
|
||||||
// ImageEditorBase
|
// ImageEditorBase
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
@ -613,5 +628,6 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem editInExternalProgramToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem editInExternalProgramToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem;
|
||||||
|
private STCheckBox componentSelector;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -116,6 +116,8 @@ namespace Switch_Toolbox.Library.Forms
|
|||||||
public bool HasGreenChannel = true;
|
public bool HasGreenChannel = true;
|
||||||
public bool HasAlphaChannel = true;
|
public bool HasAlphaChannel = true;
|
||||||
|
|
||||||
|
public bool UseComponetSelector = true;
|
||||||
|
|
||||||
ImagePropertiesEditor propertiesEditor;
|
ImagePropertiesEditor propertiesEditor;
|
||||||
|
|
||||||
public bool ShowChannelEditor = true;
|
public bool ShowChannelEditor = true;
|
||||||
@ -347,10 +349,15 @@ namespace Switch_Toolbox.Library.Forms
|
|||||||
BitmapExtension.SetChannel(image, STChannelType.Alpha, STChannelType.Alpha, STChannelType.Alpha, STChannelType.One);
|
BitmapExtension.SetChannel(image, STChannelType.Alpha, STChannelType.Alpha, STChannelType.Alpha, STChannelType.One);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!toggleAlphaChk.Checked)
|
if (UseComponetSelector)
|
||||||
{
|
{
|
||||||
BitmapExtension.SetChannel(image, STChannelType.Red, STChannelType.Green, STChannelType.Blue, STChannelType.One);
|
if (toggleAlphaChk.Checked)
|
||||||
|
BitmapExtension.SetChannel(image, ActiveTexture.RedChannel, ActiveTexture.GreenChannel, ActiveTexture.BlueChannel, ActiveTexture.AlphaChannel);
|
||||||
|
else
|
||||||
|
BitmapExtension.SetChannel(image, ActiveTexture.RedChannel, ActiveTexture.GreenChannel, ActiveTexture.BlueChannel, STChannelType.One);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
BitmapExtension.SetChannel(image, STChannelType.Red, STChannelType.Green, STChannelType.Blue, STChannelType.One);
|
||||||
}
|
}
|
||||||
|
|
||||||
DecodeProcessFinished = true;
|
DecodeProcessFinished = true;
|
||||||
@ -1055,5 +1062,10 @@ namespace Switch_Toolbox.Library.Forms
|
|||||||
UpdateEdit(ImageCache[currentCacheIndex]);
|
UpdateEdit(ImageCache[currentCacheIndex]);
|
||||||
ApplyEdit(ImageCache[currentCacheIndex]);
|
ApplyEdit(ImageCache[currentCacheIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void componentSelector_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UseComponetSelector = componentSelector.Checked;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,9 +117,6 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<metadata name="stContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
|
||||||
<value>17, 17</value>
|
|
||||||
</metadata>
|
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="pictureBoxCustom1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="pictureBoxCustom1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
@ -331,6 +328,9 @@
|
|||||||
<metadata name="stContextMenuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
<metadata name="stContextMenuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
<value>184, 17</value>
|
<value>184, 17</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
<metadata name="stContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
<value>25</value>
|
<value>25</value>
|
||||||
</metadata>
|
</metadata>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user