public void Update(byte R, byte G, byte B, Bitmap colourBitmap, bool instantTransition) { (double _, double S, double V) = HSB.RGBToHSB(R / 255.0, G / 255.0, B / 255.0); Point v1 = new Point(51.673, 0); Point v2 = new Point(104, 15.955); Point v3 = new Point(76.327, 46.125); Point v4 = new Point(24, 30.170); Point v5 = new Point(51.673, 49.875); Point v6 = new Point(104, 65.830); Point v7 = new Point(76.327, 96); Point v8 = new Point(24, 80.045); Point v15 = v1 * (B / 255.0) + v5 * (1 - B / 255.0); Point v26 = v2 * (B / 255.0) + v6 * (1 - B / 255.0); Point v37 = v3 * (B / 255.0) + v7 * (1 - B / 255.0); Point v48 = v4 * (B / 255.0) + v8 * (1 - B / 255.0); Fill1.Update(v48, v8, v7, v37, instantTransition); Fill2.Update(v37, v7, v6, v26, instantTransition); ColourImage.Source = colourBitmap; PositionEllipse.Fill = (S <0.5 && V> 0.5 ? Brushes.Black : Brushes.White); ColorPicker.SetTranslateRenderTransform(PositionEllipse, G - 24, R - 24, instantTransition); double m11 = (v26.X - v15.X) / 256; double m12 = (v37.X - v26.X) / 256; double m21 = (v26.Y - v15.Y) / 256; double m22 = (v37.Y - v26.Y) / 256; ColourCanvasTransform.Update(new Matrix(m11, m21, m12, m22, v15.X, v15.Y), instantTransition); }
public void Update(byte R, byte G, byte B, Bitmap colourBitmap, bool instantTransition) { (double _, double S, double V) = HSB.RGBToHSB(R / 255.0, G / 255.0, B / 255.0); Point v1 = new Point(51.673, 0); Point v2 = new Point(104, 15.955); Point v3 = new Point(76.327, 46.125); Point v4 = new Point(24, 30.170); Point v6 = new Point(104, 65.830); Point v7 = new Point(76.327, 96); Point v23 = v2 * (1 - R / 255.0) + v3 * (R / 255.0); Point v14 = v1 * (1 - R / 255.0) + v4 * (R / 255.0); Point v67 = v6 * (1 - R / 255.0) + v7 * (R / 255.0); Fill1.Update(v1, v2, v23, v14, instantTransition); Fill2.Update(v2, v6, v67, v23, instantTransition); ColourImage.Source = colourBitmap; PositionEllipse.Fill = (S <0.5 && V> 0.5 ? Brushes.Black : Brushes.White); ColorPicker.SetTranslateRenderTransform(PositionEllipse, G - 24, 255 - B - 24, instantTransition); double m11 = (v23.X - v14.X) / 256; double m12 = (v67.X - v23.X) / 256; double m21 = (v23.Y - v14.Y) / 256; double m22 = (v67.Y - v23.Y) / 256; ColourCanvasTransform.Update(new Matrix(m11, m21, m12, m22, v14.X, v14.Y), instantTransition); }