Files
@ d6859ea7177f
Branch filter:
Location: ATITD-Tools/Desert-Paint-Codex/Util/PixelColor.cs - annotation
d6859ea7177f
1.2 KiB
text/x-csharp
Add some sanity checks on min/max concentration and min/max reagents in recipe generation. Also, clear out the search queue when generation has finished so the queue isn't loaded next time. This fixes the start/resume button state when entering the recipe generator after a prior run had finished.
40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 7117d2e703c8 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 7117d2e703c8 40eaee10ae56 7117d2e703c8 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 7117d2e703c8 40eaee10ae56 40eaee10ae56 40eaee10ae56 7117d2e703c8 40eaee10ae56 40eaee10ae56 40eaee10ae56 7117d2e703c8 40eaee10ae56 40eaee10ae56 40eaee10ae56 40eaee10ae56 | using System;
using System.Drawing;
using DesertPaintCodex.Services;
namespace DesertPaintCodex.Util
{
public class PixelColor
{
private const int ColorTolerance = 2;
public static bool IsMatch(Color colorA, Color colorB)
{
return ((Math.Abs(colorA.R - colorB.R) <= ColorTolerance) &&
(Math.Abs(colorA.G - colorB.G) <= ColorTolerance) &&
(Math.Abs(colorA.B - colorB.B) <= ColorTolerance));
}
public static bool IsDark(Color color)
{
return (color.R < 0x47) && (color.G < 0x47) && (color.B < 0x47);
}
public static bool IsUiBackground(Color color)
{
return (color.R is >= 0x27 and <= 0x2F) && (color.G is >= 0x3B and <= 0x42) && (color.B is >= 0x41 and <= 0x48);
}
public static bool IsRed(Color color)
{
return (color.R > 0x9D) && (color.G < 0x60) && (color.B < 0x60);
}
public static bool IsGreen(Color color)
{
return (color.R < 0x60) && (color.G > 0x9D) && (color.B < 0x60);
}
public static bool IsBlue(Color color)
{
return (color.R < 0x60) && (color.G < 0x60) && (color.B > 0x9D);
}
}
}
|