public static Color1931XYZ ToXYZ(float[] spectrum, int nmFirst, int nmStep, ColorMatchingFunctions.XYZ matchingFunctions) { if (nmFirst < 0 || nmStep < 0) { throw new ArgumentOutOfRangeException(); } Color1931XYZ XYZ = default(Color1931XYZ); for (int i = 0, nm = nmFirst; i < spectrum.Length; i++, nm += nmStep) { float x̄, ȳ, z̄; matchingFunctions.GetValuesAt(nm, out x̄, out ȳ, out z̄); XYZ.X += x̄ * spectrum[i]; XYZ.Y += ȳ * spectrum[i]; XYZ.Z += z̄ * spectrum[i]; } return(XYZ); }
public Color1931XYZ ToXYZ(ColorMatchingFunctions.XYZ cmf) { return(ConvertColor.ToXYZ(Samples, FirstNanometers, StepNanometers, cmf)); }