mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-26 19:14:20 +01:00
Remove BackgroundImage usage for btnLightbar
This commit is contained in:
parent
8c67a48f4d
commit
54493e96b8
3
DS4Windows/DS4Forms/Options.Designer.cs
generated
3
DS4Windows/DS4Forms/Options.Designer.cs
generated
@ -1951,7 +1951,7 @@
|
|||||||
//
|
//
|
||||||
// pnlController
|
// pnlController
|
||||||
//
|
//
|
||||||
this.pnlController.BackColor = System.Drawing.Color.Transparent;
|
this.pnlController.BackColor = System.Drawing.Color.DimGray;
|
||||||
this.pnlController.BackgroundImage = global::DS4Windows.Properties.Resources.DS4_Config;
|
this.pnlController.BackgroundImage = global::DS4Windows.Properties.Resources.DS4_Config;
|
||||||
resources.ApplyResources(this.pnlController, "pnlController");
|
resources.ApplyResources(this.pnlController, "pnlController");
|
||||||
this.pnlController.Controls.Add(this.pBHoveredButton);
|
this.pnlController.Controls.Add(this.pBHoveredButton);
|
||||||
@ -2577,6 +2577,7 @@
|
|||||||
this.btnLightbar.Name = "btnLightbar";
|
this.btnLightbar.Name = "btnLightbar";
|
||||||
this.btnLightbar.UseVisualStyleBackColor = false;
|
this.btnLightbar.UseVisualStyleBackColor = false;
|
||||||
this.btnLightbar.Click += new System.EventHandler(this.btnLightbar_Click);
|
this.btnLightbar.Click += new System.EventHandler(this.btnLightbar_Click);
|
||||||
|
this.btnLightbar.Paint += new System.Windows.Forms.PaintEventHandler(this.btnLightbar_Paint);
|
||||||
this.btnLightbar.MouseHover += new System.EventHandler(this.btnLightbar_MouseHover);
|
this.btnLightbar.MouseHover += new System.EventHandler(this.btnLightbar_MouseHover);
|
||||||
//
|
//
|
||||||
// bnPS
|
// bnPS
|
||||||
|
@ -32,6 +32,8 @@ namespace DS4Windows
|
|||||||
private Dictionary<Control, Label> hoverLabelDict = new Dictionary<Control, Label>();
|
private Dictionary<Control, Label> hoverLabelDict = new Dictionary<Control, Label>();
|
||||||
private int[] touchpadInvertToValue = new int[4] { 0, 2, 1, 3 };
|
private int[] touchpadInvertToValue = new int[4] { 0, 2, 1, 3 };
|
||||||
private Bitmap pnlControllerBgImg;
|
private Bitmap pnlControllerBgImg;
|
||||||
|
private Bitmap btnLightBgImg;
|
||||||
|
private Bitmap btnLightBg;
|
||||||
|
|
||||||
int tempInt = 0;
|
int tempInt = 0;
|
||||||
|
|
||||||
@ -39,6 +41,7 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
pnlControllerBgImg = (Bitmap)Properties.Resources.DS4_Config.Clone();
|
pnlControllerBgImg = (Bitmap)Properties.Resources.DS4_Config.Clone();
|
||||||
|
btnLightBg = (Bitmap)Properties.Resources.DS4_lightbar.Clone();
|
||||||
pnlController.BackgroundImage = null;
|
pnlController.BackgroundImage = null;
|
||||||
pnlController.BackgroundImageLayout = ImageLayout.None;
|
pnlController.BackgroundImageLayout = ImageLayout.None;
|
||||||
mSize = MaximumSize;
|
mSize = MaximumSize;
|
||||||
@ -130,6 +133,8 @@ namespace DS4Windows
|
|||||||
bnSwipeDown.Text = Properties.Resources.SwipeDown;
|
bnSwipeDown.Text = Properties.Resources.SwipeDown;
|
||||||
bnSwipeLeft.Text = Properties.Resources.SwipeLeft;
|
bnSwipeLeft.Text = Properties.Resources.SwipeLeft;
|
||||||
bnSwipeRight.Text = Properties.Resources.SwipeRight;
|
bnSwipeRight.Text = Properties.Resources.SwipeRight;
|
||||||
|
btnLightbar.BackgroundImage = null;
|
||||||
|
btnLightbar.BackgroundImageLayout = ImageLayout.None;
|
||||||
|
|
||||||
populateHoverIndexDict();
|
populateHoverIndexDict();
|
||||||
populateHoverImageDict();
|
populateHoverImageDict();
|
||||||
@ -304,7 +309,9 @@ namespace DS4Windows
|
|||||||
reg = Color.FromArgb(color.red, color.green, color.blue);
|
reg = Color.FromArgb(color.red, color.green, color.blue);
|
||||||
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
|
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
|
||||||
main = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
main = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||||
btnLightbar.BackgroundImage = RecolorImage((Bitmap)btnLightbar.BackgroundImage, main);
|
|
||||||
|
btnLightBgImg = RecolorImage(btnLightBg, main);
|
||||||
|
btnLightbar.Refresh();
|
||||||
|
|
||||||
cBLightbyBattery.Checked = LedAsBatteryIndicator[device];
|
cBLightbyBattery.Checked = LedAsBatteryIndicator[device];
|
||||||
nUDflashLED.Value = FlashAt[device];
|
nUDflashLED.Value = FlashAt[device];
|
||||||
@ -1373,7 +1380,8 @@ namespace DS4Windows
|
|||||||
if (advColorDialog.ShowDialog() == DialogResult.OK)
|
if (advColorDialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
main = advColorDialog.Color;
|
main = advColorDialog.Color;
|
||||||
btnLightbar.BackgroundImage = RecolorImage((Bitmap)btnLightbar.BackgroundImage, main);
|
btnLightBgImg = RecolorImage(btnLightBg, main);
|
||||||
|
btnLightbar.Refresh();
|
||||||
if (FlashColor[device].Equals(new DS4Color { red = 0, green = 0, blue = 0 }))
|
if (FlashColor[device].Equals(new DS4Color { red = 0, green = 0, blue = 0 }))
|
||||||
btnFlashColor.BackColor = main;
|
btnFlashColor.BackColor = main;
|
||||||
|
|
||||||
@ -1449,7 +1457,8 @@ namespace DS4Windows
|
|||||||
reg = Color.FromArgb(tBRedBar.Value, tBGreenBar.Value, tBBlueBar.Value);
|
reg = Color.FromArgb(tBRedBar.Value, tBGreenBar.Value, tBBlueBar.Value);
|
||||||
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
|
full = HuetoRGB(reg.GetHue(), reg.GetBrightness(), reg);
|
||||||
main = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
main = Color.FromArgb((alphacolor > 205 ? 255 : (alphacolor + 50)), full);
|
||||||
btnLightbar.BackgroundImage = RecolorImage((Bitmap)btnLightbar.BackgroundImage, main);
|
btnLightBgImg = RecolorImage(btnLightBg, main);
|
||||||
|
btnLightbar.Refresh();
|
||||||
if (FlashColor[device].Equals(new DS4Color { red = 0, green = 0, blue = 0 }))
|
if (FlashColor[device].Equals(new DS4Color { red = 0, green = 0, blue = 0 }))
|
||||||
btnFlashColor.BackColor = main;
|
btnFlashColor.BackColor = main;
|
||||||
btnFlashColor.BackgroundImage = nUDRainbow.Enabled ? rainbowImg : null;
|
btnFlashColor.BackgroundImage = nUDRainbow.Enabled ? rainbowImg : null;
|
||||||
@ -1873,13 +1882,15 @@ namespace DS4Windows
|
|||||||
nUDRainbow.Enabled = on;
|
nUDRainbow.Enabled = on;
|
||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
btnLightbar.BackgroundImage = RecolorImage((Bitmap)btnLightbar.BackgroundImage, main);
|
btnLightBgImg = RecolorImage(btnLightBg, main);
|
||||||
|
btnLightbar.Refresh();
|
||||||
cBLightbyBattery.Text = Properties.Resources.DimByBattery.Replace("*nl*", "\n");
|
cBLightbyBattery.Text = Properties.Resources.DimByBattery.Replace("*nl*", "\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pnlLowBattery.Enabled = cBLightbyBattery.Checked;
|
pnlLowBattery.Enabled = cBLightbyBattery.Checked;
|
||||||
btnLightbar.BackgroundImage = RecolorImage((Bitmap)btnLightbar.BackgroundImage, main);
|
btnLightBgImg = RecolorImage(btnLightBg, main);
|
||||||
|
btnLightbar.Refresh();
|
||||||
cBLightbyBattery.Text = Properties.Resources.ColorByBattery.Replace("*nl*", "\n");
|
cBLightbyBattery.Text = Properties.Resources.ColorByBattery.Replace("*nl*", "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1913,14 +1924,15 @@ namespace DS4Windows
|
|||||||
|
|
||||||
private Bitmap RecolorImage(Bitmap image, Color color)
|
private Bitmap RecolorImage(Bitmap image, Color color)
|
||||||
{
|
{
|
||||||
Bitmap c = Properties.Resources.DS4_lightbar;
|
Bitmap c = image;
|
||||||
Bitmap d = new Bitmap(c.Width, c.Height);
|
Bitmap d = new Bitmap(c.Width, c.Height);
|
||||||
|
bool rainEnabled = nUDRainbow.Enabled;
|
||||||
|
|
||||||
for (int i = 0, bitwidth = c.Width; i < bitwidth; i++)
|
for (int i = 0, bitwidth = c.Width; i < bitwidth; i++)
|
||||||
{
|
{
|
||||||
for (int x = 0, bitheight = c.Height; x < bitheight; x++)
|
for (int x = 0, bitheight = c.Height; x < bitheight; x++)
|
||||||
{
|
{
|
||||||
if (!nUDRainbow.Enabled)
|
if (!rainEnabled)
|
||||||
{
|
{
|
||||||
Color col = c.GetPixel(i, x);
|
Color col = c.GetPixel(i, x);
|
||||||
col = Color.FromArgb((int)(col.A * (color.A / 255f)), color.R, color.G, color.B);
|
col = Color.FromArgb((int)(col.A * (color.A / 255f)), color.R, color.G, color.B);
|
||||||
@ -1928,7 +1940,7 @@ namespace DS4Windows
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Color col = HuetoRGB((i / (float)c.Width) * 360, .5f, Color.Red);
|
Color col = HuetoRGB((i / (float)bitwidth) * 360, .5f, Color.Red);
|
||||||
d.SetPixel(i, x, Color.FromArgb(c.GetPixel(i, x).A, col));
|
d.SetPixel(i, x, Color.FromArgb(c.GetPixel(i, x).A, col));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2954,6 +2966,11 @@ namespace DS4Windows
|
|||||||
e.Graphics.DrawImage(pnlControllerBgImg, 0, 0, Convert.ToInt32(pnlController.Width), Convert.ToInt32(pnlController.Height - 1));
|
e.Graphics.DrawImage(pnlControllerBgImg, 0, 0, Convert.ToInt32(pnlController.Width), Convert.ToInt32(pnlController.Height - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnLightbar_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
e.Graphics.DrawImage(btnLightBgImg, new Rectangle(0, -1, Convert.ToInt32(btnLightbar.Width), Convert.ToInt32(btnLightbar.Height - 2)));
|
||||||
|
}
|
||||||
|
|
||||||
private void Options_Resize(object sender, EventArgs e)
|
private void Options_Resize(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
fLPSettings.AutoScroll = false;
|
fLPSettings.AutoScroll = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user