示例#1
0
 private void ColorChange(float[] hsb)
 {
     if (ColorSelected != null)
     {
         ColorSelected(this, new CWColorSelectedArgs(CWColorService.ColorFromRGB(CWColorService.HSBToRGB(hsb))));
     }
 }
示例#2
0
        /// <summary>
        /// calculate the color according to the touch point
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ColorImage_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            // Debug.WriteLine("pressed");
            //  Debug.WriteLine(e.GetCurrentPoint(this.ColorPanel).Position);

            var position = e.GetCurrentPoint(this.ColorImage).Position;
            var hsb      = new float[3];

            hsb[2]          = 1.0f;
            hsb[0]          = (float)(int)(position.X / this.ColorImage.ActualWidth * 360);
            hsb[1]          = float.Parse((position.Y / this.ColorImage.ActualHeight).ToString("0.00"));
            this.Color      = CWColorService.ColorFromRGB(CWColorService.HSBToRGB(hsb));
            this.ColorPoint = position;
            ColorChange(this.Color);
        }