Make alpha seperate from colors in the hue selector for ptcl

This commit is contained in:
KillzXGaming 2019-08-20 19:56:47 -04:00
parent 1815168479
commit 4a137d34cc
5 changed files with 16 additions and 8 deletions

Binary file not shown.

View file

@ -108,17 +108,20 @@ namespace FirstPlugin
ActivePanel = panel; ActivePanel = panel;
if (ActivePanel.IsAlpha) if (ActivePanel.IsAlpha)
{ {
int alpha = panel.GetColor().R;
colorSelector1.DisplayColor = false; colorSelector1.DisplayColor = false;
colorSelector1.DisplayAlpha = true; colorSelector1.DisplayAlpha = true;
colorSelector1.Alpha = panel.GetColor().R; colorSelector1.Alpha = alpha;
UpdateColorSelector(Color.FromArgb(alpha, alpha, alpha));
} }
else else
{ {
colorSelector1.DisplayColor = true; colorSelector1.DisplayColor = true;
colorSelector1.DisplayAlpha = false; colorSelector1.DisplayAlpha = false;
UpdateColorSelector(panel.GetColor());
} }
UpdateColorSelector(panel.GetColor());
if (panel is Color8KeySlider) if (panel is Color8KeySlider)
UpdateTimeDisplay(((Color8KeySlider)panel).GetTime()); UpdateTimeDisplay(((Color8KeySlider)panel).GetTime());

View file

@ -30,10 +30,7 @@ namespace Toolbox.Library.Forms
{ {
get get
{ {
if (DisplayColor) return _color;
return _color;
else
return Color.FromArgb(Alpha, Alpha, Alpha);
} }
set set
{ {
@ -61,7 +58,7 @@ namespace Toolbox.Library.Forms
set set
{ {
displayAlpha = value; displayAlpha = value;
alphaPanel.Enabled = displayAlpha; alphaPanel.Visible = displayAlpha;
} }
} }
@ -370,6 +367,9 @@ namespace Toolbox.Library.Forms
alphaY = y; alphaY = y;
Alpha = (byte)(255 - ((float)y / (alphaPanel.Height - 1) * 255)); Alpha = (byte)(255 - ((float)y / (alphaPanel.Height - 1) * 255));
if (!huePanel.Enabled)
_color = Color.FromArgb(Alpha, Alpha, Alpha);
if (ColorChanged != null) if (ColorChanged != null)
ColorChanged(this, null); ColorChanged(this, null);
} }
@ -415,7 +415,7 @@ namespace Toolbox.Library.Forms
{ {
int x = Math.Min(Math.Max(e.X, 0), colorSquare.Width); int x = Math.Min(Math.Max(e.X, 0), colorSquare.Width);
int y = Math.Min(Math.Max(e.Y, 0), colorSquare.Height); int y = Math.Min(Math.Max(e.Y, 0), colorSquare.Height);
if (!DisplayColor) if (!huePanel.Enabled)
y = colorSquare.Height; y = colorSquare.Height;
if ((x != _squareX) || (y != _squareY)) if ((x != _squareX) || (y != _squareY))
@ -424,6 +424,11 @@ namespace Toolbox.Library.Forms
_hsv.S = (byte)((float)(colorSquare.Height - y) / colorSquare.Height * 100); _hsv.S = (byte)((float)(colorSquare.Height - y) / colorSquare.Height * 100);
OnColorChanged(true); OnColorChanged(true);
if (!huePanel.Enabled) {
Alpha = _color.R;
alphaPanel.Invalidate();
}
} }
} }
} }