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();
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
surface.compSel = new byte[4] { 0, 1, 2, 3 };
|
||||
@ -429,6 +439,11 @@ namespace FirstPlugin
|
||||
if (bitmap == null)
|
||||
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.width = (uint)bitmap.Width;
|
||||
surface.height = (uint)bitmap.Height;
|
||||
@ -594,6 +609,7 @@ namespace FirstPlugin
|
||||
compSel = reader.ReadBytes(4);
|
||||
texRegs = reader.ReadUInt32s(5);
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
MemoryStream mem = new MemoryStream();
|
||||
|
Binary file not shown.
Binary file not shown.
@ -75,6 +75,7 @@
|
||||
this.adjustmentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.hueToolStripMenuItem = 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();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
@ -196,6 +197,7 @@
|
||||
//
|
||||
// stPanel3
|
||||
//
|
||||
this.stPanel3.Controls.Add(this.componentSelector);
|
||||
this.stPanel3.Controls.Add(this.editBtn);
|
||||
this.stPanel3.Controls.Add(this.toggleAlphaChk);
|
||||
this.stPanel3.Controls.Add(this.saveBtn);
|
||||
@ -544,6 +546,19 @@
|
||||
this.brightnessContrastToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
|
||||
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
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -613,5 +628,6 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem editInExternalProgramToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem;
|
||||
private STCheckBox componentSelector;
|
||||
}
|
||||
}
|
@ -116,6 +116,8 @@ namespace Switch_Toolbox.Library.Forms
|
||||
public bool HasGreenChannel = true;
|
||||
public bool HasAlphaChannel = true;
|
||||
|
||||
public bool UseComponetSelector = true;
|
||||
|
||||
ImagePropertiesEditor propertiesEditor;
|
||||
|
||||
public bool ShowChannelEditor = true;
|
||||
@ -347,10 +349,15 @@ namespace Switch_Toolbox.Library.Forms
|
||||
BitmapExtension.SetChannel(image, STChannelType.Alpha, STChannelType.Alpha, STChannelType.Alpha, STChannelType.One);
|
||||
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;
|
||||
@ -1055,5 +1062,10 @@ namespace Switch_Toolbox.Library.Forms
|
||||
UpdateEdit(ImageCache[currentCacheIndex]);
|
||||
ApplyEdit(ImageCache[currentCacheIndex]);
|
||||
}
|
||||
|
||||
private void componentSelector_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
UseComponetSelector = componentSelector.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,9 +117,6 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</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" />
|
||||
<data name="pictureBoxCustom1.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
@ -331,6 +328,9 @@
|
||||
<metadata name="stContextMenuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>184, 17</value>
|
||||
</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">
|
||||
<value>25</value>
|
||||
</metadata>
|
||||
|
Loading…
Reference in New Issue
Block a user