-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add XYB support See merge request Wacton/Unicolour!62
- Loading branch information
Showing
22 changed files
with
235 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
namespace Wacton.Unicolour.Tests; | ||
|
||
using NUnit.Framework; | ||
using Wacton.Unicolour.Tests.Utils; | ||
|
||
public class KnownXybTests | ||
{ | ||
private const double Tolerance = 0.00000000001; | ||
|
||
[Test] | ||
public void Red() | ||
{ | ||
var red = StandardRgb.Red; | ||
TestUtils.AssertTriplet<Xyb>(red, new(0.028100083161277323, 0.4881882010413151, -0.01652922538774071), Tolerance); | ||
} | ||
|
||
[Test] | ||
public void Green() | ||
{ | ||
var green = StandardRgb.Green; | ||
TestUtils.AssertTriplet<Xyb>(green, new(-0.015386116472573375, 0.714781372724691, -0.2777046155146864), Tolerance); | ||
} | ||
|
||
[Test] | ||
public void Blue() | ||
{ | ||
var blue = StandardRgb.Blue; | ||
TestUtils.AssertTriplet<Xyb>(blue, new(0.0, 0.27812819734781813, 0.3880116647837879), Tolerance); | ||
} | ||
|
||
[Test] | ||
public void Black() | ||
{ | ||
var black = StandardRgb.Black; | ||
TestUtils.AssertTriplet<Xyb>(black, new(0.0, 0.0, 0.0), Tolerance); | ||
} | ||
|
||
[Test] | ||
public void White() | ||
{ | ||
var white = StandardRgb.White; | ||
TestUtils.AssertTriplet<Xyb>(white, new(0.0, 0.8453085619621622, 2.220446049250313e-16), Tolerance); | ||
} | ||
|
||
[Test] | ||
public void Grey() | ||
{ | ||
var grey = StandardRgb.Grey; | ||
TestUtils.AssertTriplet<Xyb>(grey, new(0.0, 0.4457393607565907, 0.0), Tolerance); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Wacton.Unicolour.Tests; | ||
|
||
using NUnit.Framework; | ||
using Wacton.Unicolour.Tests.Utils; | ||
|
||
public class RoundtripXybTests | ||
{ | ||
private const double Tolerance = 0.0000000005; | ||
|
||
[TestCaseSource(typeof(RandomColours), nameof(RandomColours.XybTriplets))] | ||
public void ViaRgbLinear(ColourTriplet triplet) | ||
{ | ||
var original = new Xyb(triplet.First, triplet.Second, triplet.Third); | ||
var rgbLinear = Xyb.ToRgbLinear(original); | ||
var roundtrip = Xyb.FromRgbLinear(rgbLinear); | ||
TestUtils.AssertTriplet(roundtrip.Triplet, original.Triplet, Tolerance); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ public enum ColourSpace | |
Yiq, | ||
Ydbdr, | ||
Tsl, | ||
Xyb, | ||
Ipt, | ||
Ictcp, | ||
Jzazbz, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.