Files
@ f28757bb21cb
Branch filter:
Location: ATITD-Tools/Desert-Paint-Lab/PaintColor.cs - annotation
f28757bb21cb
1.7 KiB
text/x-csharp
Refactor recipe / reaction computation into a common class. Add some file utilities for supporting Mac bundles. Add some scripts for building Mac app bundles. Add a help window that shows the missing reactions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 b9934660c784 | using System;
namespace DesertPaintLab
{
public class PaintColor
{
byte red;
byte green;
byte blue;
string name;
public byte Red
{
get
{
return red;
}
set
{
red = value;
}
}
public byte Blue
{
get
{
return blue;
}
set
{
blue = value;
}
}
public byte Green
{
get
{
return green;
}
set
{
green = value;
}
}
public string Name
{
get
{
return name;
}
set
{
name = value;
}
}
public PaintColor()
{
name = "Undefined";
red = 0;
green = 0;
blue = 0;
}
public PaintColor(string name, string hexRed, string hexGreen, string hexBlue)
{
this.name = name;
red = (byte)System.Int32.Parse(hexRed,
System.Globalization.NumberStyles.AllowHexSpecifier);
green = (byte)System.Int32.Parse(hexGreen,
System.Globalization.NumberStyles.AllowHexSpecifier);
blue = (byte)System.Int32.Parse(hexBlue,
System.Globalization.NumberStyles.AllowHexSpecifier);
}
public PaintColor(byte red, byte green, byte blue)
{
name = "Undefined";
this.red = red;
this.green = green;
this.blue = blue;
}
public int GetDistanceSquared(PaintColor otherColor)
{
return (int)(Math.Pow(this.red - otherColor.red, 2) +
Math.Pow(this.green - otherColor.green, 2) +
Math.Pow(this.blue - otherColor.blue, 2));
}
public void Clear()
{
red = 0;
green = 0;
blue = 0;
}
public override string ToString()
{
return "[" + name + ", " + red + ", " + green + ", " + blue + "]";
}
}
}
|