Skip to content

Commit

Permalink
rename CIEUCS Coder-Spirit#8
Browse files Browse the repository at this point in the history
  • Loading branch information
TerribleDev committed Oct 24, 2015
1 parent 73713bd commit 2114f0f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 31 deletions.
14 changes: 3 additions & 11 deletions ColorSharp/ColorSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -58,7 +58,7 @@
<Compile Include="src\ColorSpaces\CIExyY.cs" />
<Compile Include="src\InternalUtils\Comparers.cs" />
<Compile Include="src\InternalUtils\Structs.cs" />
<Compile Include="src\ColorSpaces\CIEUCS.cs" />
<Compile Include="src\ColorSpaces\CIE1960.cs" />
<Compile Include="src\Illuminants\CIE_D65.cs" />
<Compile Include="src\Illuminants\CIE_A.cs" />
<Compile Include="src\InternalUtils\IRealInterpolatedFunctionWithFiniteSupport.cs" />
Expand Down Expand Up @@ -88,15 +88,7 @@
<Compile Include="src\Strategies\LMSStrategy.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="src\" />
<Folder Include="src\ColorSpaces\" />
<Folder Include="src\LightSpectrums\" />
<Folder Include="src\MatchingFunctions\" />
<Folder Include="src\InternalUtils\" />
<Folder Include="src\Illuminants\" />
<Folder Include="src\Strategies\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="ColorSharp.nuspec" />
<None Include="build_nuget_pkg.sh" />
Expand Down
6 changes: 3 additions & 3 deletions ColorSharp/src/ColorSpaces/AConvertibleColor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ AConvertibleColor InnerConvertTo (Type t)
return ToCIEXYZ ();
if (t == typeof(CIExyY))
return ToCIExyY();
if (t == typeof(CIEUCS))
if (t == typeof(CIE1960))
return ToCIEUCS ();
if (t == typeof(SRGB))
return ToSRGB ();
Expand Down Expand Up @@ -183,9 +183,9 @@ public virtual CIExyY ToCIExyY ()
/**
* <summary>Converts the color sample to a CIE's 1960 UCS color sample.</summary>
*/
public virtual CIEUCS ToCIEUCS ()
public virtual CIE1960 ToCIEUCS ()
{
return (DataSource as CIEUCS) ?? ToCIEXYZ ().ToCIEUCS ();
return (DataSource as CIE1960) ?? ToCIEXYZ ().ToCIEUCS ();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace ColorSpaces
/**
* <summary>CIE's 1960 UCS Color Space. Also named CIE's 1960 Yuv Color Space.</summary>
*/
public sealed class CIEUCS : AConvertibleColor
public sealed class CIE1960 : AConvertibleColor
{
#region properties

Expand Down Expand Up @@ -78,7 +78,7 @@ public sealed class CIEUCS : AConvertibleColor
*/
public double Y { get { return V; } }

static List<CIEUCS> TemperatureChromaticities = null;
static List<CIE1960> TemperatureChromaticities = null;

double CCT = double.NaN;

Expand All @@ -96,7 +96,7 @@ public sealed class CIEUCS : AConvertibleColor
* <param name="W">CIE's 1960 UCS W coordinate</param>
* <param name="dataSource">If you aren't working with ColorSharp internals, don't use this parameter</param>
*/
public CIEUCS (double U, double V, double W, AConvertibleColor dataSource=null) : base(dataSource)
public CIE1960 (double U, double V, double W, AConvertibleColor dataSource=null) : base(dataSource)
{
if (U < 0.0 || V < 0.0 || W < 0.0) {
throw new ArgumentException ("Invalid color point");
Expand All @@ -120,7 +120,7 @@ public CIEUCS (double U, double V, double W, AConvertibleColor dataSource=null)
* <param name="W">CIE's 1960 UCS W coordinate</param>
* <param name="dataSource">If you aren't working with ColorSharp internals, don't use this parameter</param>
*/
public CIEUCS (AConvertibleColor dataSource, double u, double v, double W) : base(dataSource)
public CIE1960 (AConvertibleColor dataSource, double u, double v, double W) : base(dataSource)
{
if (u < 0.0 || v < 0.0 || W < 0 || u + v > 1.0) {
throw new ArgumentException ("Invalid color point");
Expand Down Expand Up @@ -150,7 +150,7 @@ public CIEUCS (AConvertibleColor dataSource, double u, double v, double W) : bas
* <param name="W">CIE's 1960 UCS W coordinate</param>
* <param name="dataSource">If you aren't working with ColorSharp internals, don't use this parameter</param>
*/
public CIEUCS (double U, double V, double u, double v, double W, AConvertibleColor dataSource=null) : base(dataSource)
public CIE1960 (double U, double V, double u, double v, double W, AConvertibleColor dataSource=null) : base(dataSource)
{
if (U < 0.0 || V < 0.0 || W < 0.0 || u < 0.0 || v < 0.0) {
throw new ArgumentException ("Invalid color point");
Expand Down Expand Up @@ -203,7 +203,7 @@ public override double GetCCT ()
// Precomputing interpolation tables...
if (TemperatureChromaticities == null) {
// Oversized to improve alignment (needs 302).
TemperatureChromaticities = new List<CIEUCS> (512);
TemperatureChromaticities = new List<CIE1960> (512);

// From 1000º K to 20000º K
for (double t = 1000.0; t < 20001.0; t *= 1.01) {
Expand Down Expand Up @@ -286,7 +286,7 @@ public override CIEXYZ ToCIEXYZ ()
/**
* <inheritdoc />
*/
public override CIEUCS ToCIEUCS ()
public override CIE1960 ToCIEUCS ()
{
return this;
}
Expand All @@ -301,7 +301,7 @@ public override CIEUCS ToCIEUCS ()
*/
public override bool Equals(Object obj)
{
CIEUCS ucsObj = obj as CIEUCS;
CIE1960 ucsObj = obj as CIE1960;

if (ucsObj == this) {
return true;
Expand Down
4 changes: 2 additions & 2 deletions ColorSharp/src/ColorSpaces/CIEXYZ.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public override CIExyY ToCIExyY ()
/**
* <inheritdoc />
*/
public override CIEUCS ToCIEUCS ()
public override CIE1960 ToCIEUCS ()
{
return (DataSource as CIEUCS) ?? new CIEUCS (
return (DataSource as CIE1960) ?? new CIE1960 (
2.0 * X / 3.0, // U
Y, // V
4 * X / (X + 15 * Y + 3 * Z), // u
Expand Down
8 changes: 4 additions & 4 deletions ColorSharp/src/ColorSpaces/CIExyY.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ public override CIExyY ToCIExyY ()
/**
* <inheritdoc />
*/
public override CIEUCS ToCIEUCS ()
public override CIE1960 ToCIEUCS ()
{
if (DataSource is CIEUCS) {
return DataSource as CIEUCS;
if (DataSource is CIE1960) {
return DataSource as CIE1960;
}

// Warning, it's not a good idea to do it with other types, we do with CIEXYZ bacause
Expand All @@ -208,7 +208,7 @@ public override CIEUCS ToCIEUCS ()
double div = (12 * y - 2 * x + 3);
double yy = Y / y;

return new CIEUCS (
return new CIE1960 (
DataSource ?? this,
4 * x / div, 6 * y / div, 0.5 * (-x * yy + 3 * Y + yy * (1.0 - x - y))
);
Expand Down
6 changes: 3 additions & 3 deletions ColorSharpTests/tests/ColorSpaces/AColorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public void TestConversionSimpleChains()
);

Assert.AreEqual (
new CIEXYZ (50.0, 60.0, 30.0).ConvertTo<CIEUCS> (),
new CIEXYZ (50.0, 60.0, 30.0).ConvertTo<CIExyY> ().ConvertTo<CIEUCS> ()
new CIEXYZ (50.0, 60.0, 30.0).ConvertTo<CIE1960> (),
new CIEXYZ (50.0, 60.0, 30.0).ConvertTo<CIExyY> ().ConvertTo<CIE1960> ()
);

Assert.AreEqual (
new CIEXYZ (50.0, 60.0, 30.0).ConvertTo<CIExyY> (),
new CIEXYZ (50.0, 60.0, 30.0).ConvertTo<CIEUCS> ().ConvertTo<CIExyY> ()
new CIEXYZ (50.0, 60.0, 30.0).ConvertTo<CIE1960> ().ConvertTo<CIExyY> ()
);

// From xyY
Expand Down

0 comments on commit 2114f0f

Please sign in to comment.