Commit fce70e12 authored by niklasCarstensen's avatar niklasCarstensen
Browse files

Add UwU

parent 5e49eee9
Pipeline #2849 passed with stage
in 1 minute
......@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace MEE7.Backend.HelperFunctions
{
public static class Extensions
public static class Extensions // uwu
{
public static bool IsFileLocked(this FileInfo file) // from https://stackoverflow.com/questions/876473/is-there-a-way-to-check-if-a-file-is-in-use
{
......
......@@ -567,6 +567,22 @@ namespace MEE7.Commands.Edit
return b;
}
public string layerHSVDesc = "Split image into two layers ";
public Bitmap LayerHSV(Bitmap b, IMessage m, Pipe thresholder)
{
using (UnsafeBitmapContext con = new UnsafeBitmapContext(b))
for (int x = 0; x < b.Width; x++)
for (int y = 0; y < b.Height; y++)
{
Color c = con.GetPixel(x, y);
c.ColorToHSV(out double h, out double s, out double v);
if ((bool)thresholder.Apply(m, null, new Dictionary<string, object>() { { "h", h }, { "s", s * 100 }, { "v", v * 100 } }))
con.SetPixel(x, y, Color.FromArgb(0, c));
}
return b;
}
public string hueScaleDesc = "Grayscaled Hue channel of the image";
public Bitmap HueScale(Bitmap b, IMessage m)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment