private void DrawPoint(DepthImageFrame depthFrame, int depthIndex, int minDepth) { double x_kinect = (depthIndex % depthFrame.Width); double y_kinect = (depthIndex / depthFrame.Width); double x = x_kinect * calibration_coefficients[0] + y_kinect * calibration_coefficients[1] + calibration_coefficients[2] + 3; double y = x_kinect * calibration_coefficients[3] + y_kinect * calibration_coefficients[4] + calibration_coefficients[5] + 10; foreach (Ellipse ellipse in buttons) { double top = Canvas.GetTop(ellipse); double left = Canvas.GetLeft(ellipse); if (y >= top && x >= left && y <= top + ellipse.Height && x <= left + ellipse.Width) { DropShadowEffect glowEffect = new DropShadowEffect(); glowEffect.ShadowDepth = 0; glowEffect.Opacity = 1; glowEffect.BlurRadius = 30; if (ellipse.Name != "refresh_selector" && ellipse.Name != "background_selector") { foreach (Ellipse el in buttons) { if (el.Name != "refresh_selector" && el.Name != "background_selector") { el.Fill.Opacity = 0.3; el.Effect = null; } } } // Use this button if (ellipse.Name == "red_selector") { ellipse.Fill.Opacity = 1; glowEffect.Color = Color.FromArgb(255, 255, 44, 44); ellipse.Effect = glowEffect; drawController.ChangeColor(Colors.Red); } else if (ellipse.Name == "green_selector") { ellipse.Fill.Opacity = 1; glowEffect.Color = Color.FromArgb(255, 53, 255, 53); ellipse.Effect = glowEffect; drawController.ChangeColor(Colors.Green); } else if (ellipse.Name == "blue_selector") { ellipse.Fill.Opacity = 1; glowEffect.Color = Color.FromArgb(255, 115, 78, 255); ellipse.Effect = glowEffect; drawController.ChangeColor(Colors.Blue); } else if (ellipse.Name == "eraser_selector") { ellipse.Fill.Opacity = 1; glowEffect.Color = Color.FromArgb(255, 255, 255, 255); ellipse.Effect = glowEffect; drawController.ChangeColor(Colors.White); } else if (ellipse.Name == "background_selector") { TimeSpan interval = DateTime.Now - last_background_change; if (interval.Seconds >= 0.5) { drawController.CycleBackgrounds(); last_background_change = DateTime.Now; } } else if (ellipse.Name == "refresh_selector") { drawController.ClearScreen(); } return; } } drawController.DrawEllipseAtPoint(x, y, (DepthThreshold - minDepth)); }