private void colorCombo_SelectedIndexChanged(object sender, EventArgs e) { if (m_isUpdating) { return; } CurrentColorChanged?.Invoke(this, null); }
private void transparencySlider_ValueChanged(object sender, EventArgs e) { percentageLabel.Text = ((int)((transparencySlider.Value / (double)byte.MaxValue) * 100)).ToString() + "%"; if (m_isUpdating) { return; } CurrentColorChanged?.Invoke(this, null); }
private void EhOpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (_notUserInitiated) { return; } var c = _newColor; float a = (float)e.NewValue; _newColor = AxoColor.FromScRgb(a, c.ScR, c.ScG, c.ScB); UpdateControlVisuals(); CurrentColorChanged?.Invoke(_newColor); }
public void ChangeCurrentColor(AxoColor newColor, bool updateCircle, bool updateVariations, bool updateComponents, bool updateAltComponents) { _currentColor = newColor; if (updateCircle) { _guiColorCircleSurface.SetHueBaseValue(_currentColor.GetHue(), false); } if (updateComponents) { // now calculate components var components = _colorModel.GetComponentsForColor(_currentColor); UpdateComponentValues(() => { for (int i = 0; i < components.Length; ++i) { _guiComponents[i].Value = (decimal)components[i]; } if (_colorModel.IsUsingByteComponents) { _guiAlphaValue.Value = _currentColor.A; } else { _guiAlphaValue.Value = (decimal)_currentColor.ScA; } } ); } if (updateAltComponents) { // update alternative components var altComponents = _altColorModel.GetComponentsForColor(_currentColor, Altaxo.Settings.GuiCulture.Instance); for (int i = 0; i < altComponents.Length; ++i) { _guiAltComponents[i].Text = altComponents[i]; } } CurrentColorChanged?.Invoke(_currentColor); }
public void ChangeCurrentColor(AxoColor newColor, bool update1D, bool update2D, bool updateComponents, bool updateAltComponents) { _currentColor = newColor; if (update1D || update2D) { var(pos1D, pos2D) = _colorModel.GetRelativePositionsFor1Dand2DColorSurfaceFromColor(_currentColor); _gui1DColorControl.SelectionRectangleRelativePositionChanged -= Eh1DColorControl_ValueChanged; _gui2DColorControl.SelectionRectangleRelativePositionChanged -= Eh2DColorControl_ValueChanged; _gui1DColorControl.SelectionRectangleRelativePosition = pos1D; _gui2DColorControl.SelectionRectangleRelativePosition = pos2D; _gui1DColorControl.SelectionRectangleRelativePositionChanged += Eh1DColorControl_ValueChanged; _gui2DColorControl.SelectionRectangleRelativePositionChanged += Eh2DColorControl_ValueChanged; } if (updateComponents) { // now calculate components var components = _colorModel.GetComponentsForColor(_currentColor); UpdateComponentValues(() => { for (int i = 0; i < components.Length; ++i) { _guiComponents[i].Value = (decimal)components[i]; } } ); } if (updateAltComponents) { // update alternative components var altComponents = _altColorModel.GetComponentsForColor(_currentColor, Altaxo.Settings.GuiCulture.Instance); for (int i = 0; i < altComponents.Length; ++i) { _guiAltComponents[i].Text = altComponents[i]; } } CurrentColorChanged?.Invoke(_currentColor); }
private void EhBrightnessSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (_notUserInitiated) { return; } Color nc = colorComb.SelectedColor; float f = (float)e.NewValue; float a, r, g, b; a = (float)opacitySlider.Value; r = f * nc.ScR; g = f * nc.ScG; b = f * nc.ScB; _newColor = AxoColor.FromScRgb(a, r, g, b); UpdateControlVisuals(); CurrentColorChanged?.Invoke(_newColor); }
// // Event Handlers private void EhColorCombControl_ColorSelected(object sender, ColorEventArgs e) { if (_notUserInitiated) { return; } float a, f, r, g, b; a = (float)opacitySlider.Value; f = (float)brightnessSlider.Value; Color nc = e.Color; r = f * nc.ScR; g = f * nc.ScG; b = f * nc.ScB; _newColor = AxoColor.FromScRgb(a, r, g, b); UpdateControlVisuals(); CurrentColorChanged?.Invoke(_newColor); }