Пример #1
0
        private void BlackMenu_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_cmykValues == null)
                {
                    _cmykValues = CmykSpace.RgbToCmyk(_rgbValues);
                }

                if (_blackBms == null)
                {
                    var newJpegBytes = new byte[BmsEngine.DataLength];
                    for (var i = 0; i < BmsEngine.DataLength; i += 4)
                    {
                        newJpegBytes[i + (int)Rgb.Blue]        =
                            newJpegBytes[i + (int)Rgb.Green]   =
                                newJpegBytes[i + (int)Rgb.Red] =
                                    (byte)Math.Min(255.0, (255 * (1.0 - _cmykValues[i + (int)Cmyk.Black])));
                    }
                    _blackBms = BmsEngine.CloneBms(newJpegBytes);
                }
                ImgPhoto.Source = _blackBms;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Eroare: " + ex.Message, "Efecte poze", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #2
0
        private void CmykToRGBMenu_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_cmykValues == null)
                {
                    _cmykValues = CmykSpace.RgbToCmyk(_rgbValues);
                }

                if (_cmykToRgbBms == null)
                {
                    var newJpegBytes = CmykSpace.CmykToRgb(_cmykValues);
                    _cmykToRgbBms = BmsEngine.CloneBms(newJpegBytes);
                }
                ImgPhoto.Source = _cmykToRgbBms;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Eroare: " + ex.Message, "Efecte poze", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }