Exemplo n.º 1
0
 /**
  * <summary>Creates a new color sample in the CIE's 1931 xyY color space</summary>
  * <param name="X">CIE's 1931 XYZ X coordinate</param>
  * <param name="Y">CIE's 1931 XYZ Y coordinate</param>
  * <param name="Z">CIE's 1931 XYZ Z coordinate</param>
  * <param name="dataSource">If you aren't working with ColorSharp internals, don't use this parameter</param>
  */
 public CIEXYZ(double X, double Y, double Z, AConvertibleColor dataSource=null)
     : base(dataSource)
 {
     this.X = X;
     this.Y = Y;
     this.Z = Z;
 }
Exemplo n.º 2
0
 /**
  * <summary>Creates a new color sample in the sRGB color space</summary>
  * <param name="R">Red component (between 0 and 1)</param>
  * <param name="G">Green component (between 0 and 1)</param>
  * <param name="B">Blue component (between 0 and 1)</param>
  * <param name="dataSource">If you aren't working with ColorSharp internals, don't use this parameter</param>
  */
 public SRGB(double R, double G, double B, AConvertibleColor dataSource=null)
     : base(dataSource)
 {
     this.R = R;
     this.G = G;
     this.B = B;
 }
Exemplo n.º 3
0
            /**
             * <summary>
             *   Creates a new color sample in the CIE's 1960 UCS color space. This is a convenience constructor to
             *   allow minimum information loss in color space conversions, but not recommeneded to construct colors
             *   "by hand".
             * </summary>
             * <param name="U">CIE's 1960 UCS U coordinate</param>
             * <param name="V">CIE's 1960 UCS V coordinate</param>
             * <param name="u">CIE's 1960 UCS u coordinate</param>
             * <param name="v">CIE's 1960 UCS v coordinate</param>
             * <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 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");
                }

                if (Math.Abs(U / (U + V + W) - u) > 1e-15)
                {
                    throw new ArgumentException("Inconsistent data");
                }
                if (Math.Abs(V / (U + V + W) - v) > 1e-15)
                {
                    throw new ArgumentException("Inconsistent data");
                }

                this.U = U;
                this.V = V;
                this.u = u;
                this.v = v;
                this.W = W;

                //GetMinorCase = true;
                //GetMajorCase = true;
            }
Exemplo n.º 4
0
            protected ASimpleColor(
				AConvertibleColor whiteReference=null, AConvertibleColor dataSource=null
			)
                : base(dataSource)
            {
                if (whiteReference == null) {
                    WhiteReference = CIE_D65.XYZ_Sample;
                } else {
                    WhiteReference = whiteReference;
                }
            }
Exemplo n.º 5
0
 protected ASimpleColor(
     AConvertibleColor whiteReference = null, AConvertibleColor dataSource = null
     )  : base(dataSource)
 {
     if (whiteReference == null)
     {
         WhiteReference = CIE_D65.XYZ_Sample;
     }
     else
     {
         WhiteReference = whiteReference;
     }
 }
Exemplo n.º 6
0
            /**
             * <summary>Creates a new color sample in the CIE's 1960 UCS color space</summary>
             * <param name="u">CIE's 1960 UCS u coordinate</param>
             * <param name="v">CIE's 1960 UCS v coordinate</param>
             * <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 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");
                }

                //GetMinorCase = true;
                //GetMajorCase = false;

                this.u = u;
                this.v = v;
                this.W = W;

                U = W * u / (1.0 - u - v);
                V = W * v / (1.0 - u - v);
            }
Exemplo n.º 7
0
            /**
             * <summary>Creates a new color sample in the CIE's 1960 UCS color space</summary>
             * <param name="U">CIE's 1960 UCS U coordinate</param>
             * <param name="V">CIE's 1960 UCS V coordinate</param>
             * <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 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");
                }

                //GetMinorCase = false;
                //GetMajorCase = true;

                this.U = U;
                this.V = V;
                this.W = W;

                u = U / (U + V + W);
                v = V / (U + V + W);
            }
Exemplo n.º 8
0
            public LMS(double L, double M, double S, AConvertibleColor dataSource=null)
                : base(dataSource)
            {
                if (double.IsNaN (L) || double.IsInfinity (L)) {
                    throw new ArgumentException ("L must be a real number", "L");
                }
                if (double.IsNaN (M) || double.IsInfinity (M)) {
                    throw new ArgumentException ("M must be a real number", "M");
                }
                if (double.IsNaN (S) || double.IsInfinity (S)) {
                    throw new ArgumentException ("S must be a real number", "S");
                }

                this.L = L;
                this.M = M;
                this.S = S;
            }
Exemplo n.º 9
0
            public LMS(double L, double M, double S, AConvertibleColor dataSource = null) : base(dataSource)
            {
                if (double.IsNaN(L) || double.IsInfinity(L))
                {
                    throw new ArgumentException("L must be a real number", "L");
                }
                if (double.IsNaN(M) || double.IsInfinity(M))
                {
                    throw new ArgumentException("M must be a real number", "M");
                }
                if (double.IsNaN(S) || double.IsInfinity(S))
                {
                    throw new ArgumentException("S must be a real number", "S");
                }

                this.L = L;
                this.M = M;
                this.S = S;
            }
 /**
  * <inheritdoc />
  */
 protected AInterpolatedLightSpectrum(AConvertibleColor dataSource = null) : base(dataSource)
 {
 }
Exemplo n.º 11
0
 /**
  * <summary>Creates a new color sample in the CIE's 1931 xyY color space</summary>
  * <param name="x">CIE's 1931 xyY x coordinate</param>
  * <param name="y">CIE's 1931 xyY y coordinate</param>
  * <param name="Y">Lightness parameter</param>
  * <param name="dataSource">If you aren't working with ColorSharp internals, don't use this parameter</param>
  */
 public CIExyY(double x, double y, double Y, AConvertibleColor dataSource = null) : base(dataSource)
 {
     this.x = x;
     this.y = y;
     this.Y = Y;
 }
Exemplo n.º 12
0
 /**
  * Preconditions : amplitudes MUST be sorted (crescent order)
  */
 public TabularLightSpectrum(List<KeyValuePair<double, double>> amplitudes, AConvertibleColor dataSource=null)
     : base(dataSource)
 {
     RawAmplitudes = amplitudes;
 }
Exemplo n.º 13
0
 /**
  * <summary>Creates a new color sample in the CIE's 1931 xyY color space</summary>
  * <param name="X">CIE's 1931 XYZ X coordinate</param>
  * <param name="Y">CIE's 1931 XYZ Y coordinate</param>
  * <param name="Z">CIE's 1931 XYZ Z coordinate</param>
  * <param name="dataSource">If you aren't working with ColorSharp internals, don't use this parameter</param>
  */
 public CIEXYZ(double X, double Y, double Z, AConvertibleColor dataSource = null) : base(dataSource)
 {
     this.X = X;
     this.Y = Y;
     this.Z = Z;
 }
Exemplo n.º 14
0
 /**
  * <param name="minWaveLength">Associated wavelength to the first value of 'amplitudes'.</param>
  * <param name="amplitudes">Equidistant data points.</param>
  * <param name="nmPerStep">Nanometers between each data point in 'amplitudes'.</param>
  * <param name="dataSource">
  *     Reference to a AConvertibleColor instance from which this object has been generated.
  * </param>
  */
 public RegularLightSpectrum(double minWaveLength, IList <double> amplitudes, double nmPerStep, AConvertibleColor dataSource = null) : base(dataSource)
 {
     NmPerStep     = nmPerStep;
     MinWaveLength = minWaveLength;
     MaxWaveLength = minWaveLength + nmPerStep * (amplitudes.Count - 1);
     Amplitudes    = new ReadOnlyCollection <double> (amplitudes);
 }
Exemplo n.º 15
0
            /**
             * <summary>Creates a new color sample in the CIE's 1960 UCS color space</summary>
             * <param name="U">CIE's 1960 UCS U coordinate</param>
             * <param name="V">CIE's 1960 UCS V coordinate</param>
             * <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 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");
                }

                GetMinorCase = false;
                GetMajorCase = true;

                this.U = U;
                this.V = V;
                this.W = W;

                u = U / (U + V + W);
                v = V / (U + V + W);
            }
Exemplo n.º 16
0
            /**
             * <summary>
             *   Creates a new color sample in the CIE's 1960 UCS color space. This is a convenience constructor to
             *   allow minimum information loss in color space conversions, but not recommeneded to construct colors
             *   "by hand".
             * </summary>
             * <param name="U">CIE's 1960 UCS U coordinate</param>
             * <param name="V">CIE's 1960 UCS V coordinate</param>
             * <param name="u">CIE's 1960 UCS u coordinate</param>
             * <param name="v">CIE's 1960 UCS v coordinate</param>
             * <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 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");
                }

                if (Math.Abs (U / (U + V + W) - u) > 1e-15) {
                    throw new ArgumentException ("Inconsistent data");
                }
                if (Math.Abs (V / (U + V + W) - v) > 1e-15) {
                    throw new ArgumentException ("Inconsistent data");
                }

                this.U = U;
                this.V = V;
                this.u = u;
                this.v = v;
                this.W = W;

                GetMinorCase = true;
                GetMajorCase = true;
            }
Exemplo n.º 17
0
            /**
             * <summary>Creates a new color sample in the CIE's 1960 UCS color space</summary>
             * <param name="u">CIE's 1960 UCS u coordinate</param>
             * <param name="v">CIE's 1960 UCS v coordinate</param>
             * <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 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");
                }

                GetMinorCase = true;
                GetMajorCase = false;

                this.u = u;
                this.v = v;
                this.W = W;

                U = W * u / (1.0 - u - v);
                V = W * v / (1.0 - u - v);
            }
Exemplo n.º 18
0
 /**
  * <summary>Creates a new color sample in the CIE's 1931 xyY color space</summary>
  * <param name="x">CIE's 1931 xyY x coordinate</param>
  * <param name="y">CIE's 1931 xyY y coordinate</param>
  * <param name="Y">Lightness parameter</param>
  * <param name="dataSource">If you aren't working with ColorSharp internals, don't use this parameter</param>
  */
 public CIExyY(double x, double y, double Y, AConvertibleColor dataSource=null)
     : base(dataSource)
 {
     this.x = x;
     this.y = y;
     this.Y = Y;
 }
Exemplo n.º 19
0
 /**
  * Boilerplate constructor
  */
 protected ALightSpectrum(AConvertibleColor dataSource=null)
     : base(dataSource)
 {
 }
Exemplo n.º 20
0
 /**
  * <summary>Creates a new color sample in the sRGB color space</summary>
  * <param name="R">Red component (between 0 and 1)</param>
  * <param name="G">Green component (between 0 and 1)</param>
  * <param name="B">Blue component (between 0 and 1)</param>
  * <param name="dataSource">If you aren't working with ColorSharp internals, don't use this parameter</param>
  */
 public SRGB(double R, double G, double B, AConvertibleColor dataSource = null) : base(dataSource)
 {
     this.R = R;
     this.G = G;
     this.B = B;
 }
Exemplo n.º 21
0
 /**
  * Boilerplate constructor
  */
 protected AConvertibleColor(AConvertibleColor dataSource = null)
 {
     DataSource = dataSource;
 }
Exemplo n.º 22
0
 /**
  * Preconditions : amplitudes MUST be sorted (crescent order)
  */
 public TabularLightSpectrum(List <KeyValuePair <double, double> > amplitudes, AConvertibleColor dataSource = null) : base(dataSource)
 {
     RawAmplitudes = amplitudes;
 }