private void UpdateSample(int xPos, int yPos) { if (m_colorSample == null) { return; } if (xPos < 0 || xPos > m_colorSample.Width) { return; } if (yPos < 0 || yPos > m_colorSample.Height) { return; } m_sampleSelector.SetValue(Canvas.LeftProperty, xPos - (m_sampleSelector.Height / 2)); m_sampleSelector.SetValue(Canvas.TopProperty, yPos - (m_sampleSelector.Height / 2)); float yComponent = 1 - (float)(yPos / m_colorSample.Height); float xComponent = (float)(xPos / m_colorSample.Width); this.SelectedColor = m_colorSpace.ConvertHsvToRgb(m_selectedHue, xComponent, yComponent); m_selectedColorView.Fill = new SolidColorBrush(this.SelectedColor); m_hexValue.Text = m_colorSpace.GetHexCode(this.SelectedColor); if (ColorSelected != null) { ColorSelected(this.SelectedColor); } }
private void UpdateSatValSelection() { if (m_colorSample == null) { return; } m_sampleSelector.SetValue(Canvas.LeftProperty, m_sampleX - (m_sampleSelector.Height / 2)); m_sampleSelector.SetValue(Canvas.TopProperty, m_sampleY - (m_sampleSelector.Height / 2)); Color currColor = GetColor(); m_selectedColorView.Fill = new SolidColorBrush(currColor); m_hexValue.Text = m_colorSpace.GetHexCode(currColor); FireSelectedColorChangingEvent(currColor); }