Пример #1
0
        private void LightnessMenu_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_hslValues == null)
                {
                    _hslValues = HslSpace.RgbToHsl(_rgbValues);
                }

                if (_lightnessBms == null)
                {
                    var newJpegBytes = new byte[BmsEngine.DataLength];
                    for (var i = 0; i < BmsEngine.DataLength; i += 4)
                    {
                        newJpegBytes[i + (int)Rgb.Red]          =
                            newJpegBytes[i + (int)Rgb.Green]    =
                                newJpegBytes[i + (int)Rgb.Blue] = (byte)(_hslValues[i + (int)Hsl.Lightness] * 255);
                    }
                    _lightnessBms = BmsEngine.CloneBms(newJpegBytes);
                }
                ImgPhoto.Source = _lightnessBms;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Eroare: " + ex.Message, "Efecte poze", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #2
0
 private void HslToRGBMenu_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (_hslValues == null)
         {
             _hslValues = HslSpace.RgbToHsl(_rgbValues);
         }
         if (_hslToRgbBms == null)
         {
             var newJpegBytes = HslSpace.HslToRgb(_hslValues);
             _hslToRgbBms = BmsEngine.CloneBms(newJpegBytes);
         }
         ImgPhoto.Source = _hslToRgbBms;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Eroare: " + ex.Message, "Efecte poze", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }