Fix artifacting on firmware status icons under Mono
This commit is contained in:
parent
31dd2dbd2f
commit
694aa867ec
|
@ -13,6 +13,16 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
private const string PLACEHOLDER_TITLE = "(will take value from WindowTitle/WindowTitleStatic)";
|
private const string PLACEHOLDER_TITLE = "(will take value from WindowTitle/WindowTitleStatic)";
|
||||||
|
|
||||||
|
/// <summary>removes transparency from an image by combining it with a solid background</summary>
|
||||||
|
public static Image FillImageBackground(Image img, Color c)
|
||||||
|
{
|
||||||
|
Bitmap result = new(width: img.Width, height: img.Height);
|
||||||
|
using var g = Graphics.FromImage(result);
|
||||||
|
g.Clear(c);
|
||||||
|
g.DrawImage(img, x: 0, y: 0, width: img.Width, height: img.Height);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Under Mono, <see cref="SystemColors.Control">SystemColors.Control</see> returns an ugly beige.<br/>
|
/// Under Mono, <see cref="SystemColors.Control">SystemColors.Control</see> returns an ugly beige.<br/>
|
||||||
/// This method recursively replaces the <see cref="Control.BackColor"/> of the given <paramref name="control"/> (can be a <see cref="Form"/>) with <see cref="Color.WhiteSmoke"/>
|
/// This method recursively replaces the <see cref="Control.BackColor"/> of the given <paramref name="control"/> (can be a <see cref="Form"/>) with <see cref="Color.WhiteSmoke"/>
|
||||||
|
|
|
@ -145,7 +145,13 @@ namespace BizHawk.Client.EmuHawk
|
||||||
= tbbOpenFolder.Image = Properties.Resources.Placeholder;
|
= tbbOpenFolder.Image = Properties.Resources.Placeholder;
|
||||||
|
|
||||||
// prep ImageList for ListView
|
// prep ImageList for ListView
|
||||||
foreach (var img in StatusIcons.Values) imageList1.Images.Add(img);
|
var iconList = StatusIcons.Values;
|
||||||
|
if (OSTailoredCode.IsUnixHost) // remove crusty artifacts
|
||||||
|
{
|
||||||
|
var bg = lvFirmware.BackColor;
|
||||||
|
iconList = iconList.Select(img => FormBase.FillImageBackground(img, bg));
|
||||||
|
}
|
||||||
|
foreach (var img in iconList) imageList1.Images.Add(img);
|
||||||
|
|
||||||
_listViewSorter = new ListViewSorter(-1);
|
_listViewSorter = new ListViewSorter(-1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue