예제 #1
0
        private void UpdateSelector()
        {
            double x = this.X;
            double y = this.Y;

            if (!double.IsNaN(x) && !double.IsNaN(y))
            {
                CIEXYZColour xyz = (CIEXYZColour) new CIEXYYColor(x, y, 0.5);

                this.selector.Margin = new Thickness(
                    cieplot.Margin.Left + x * cieplot.ActualWidth - this.selector.ActualWidth / 2,
                    cieplot.Margin.Top + (1.0 - y) * cieplot.ActualHeight - this.selector.ActualHeight / 2,
                    0, 0);

                this.selector.Fill = new SolidColorBrush(xyz.ToRGB(cieplot.cieRgbDefinition, limitGamut: false));
            }
        }
예제 #2
0
        protected virtual RGBStruct ColourFunction(double x, double y)
        {
            CIEXYYColor xyy = new CIEXYYColor(x, y, 1.0);

            CIEXYZColour xyz = (CIEXYZColour)xyy;

            RGBColor rgb = xyz.ToRGB(cieRgbDefinition, false);

            if (rgb.OutOfGamut)
            {
                return(new RGBStruct(rgb.Rb, rgb.Gb, rgb.Bb, 128)); // Values are clamped automatically
            }
            else
            {
                return(new RGBStruct(rgb.Rb, rgb.Gb, rgb.Bb, 255));
            }
        }