コード例 #1
0
        private void UniformQuantizing_YCbCr_OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new SimpleQuantizingDialog();

            dialog.ShowDialog();
            if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
            {
                var image  = (BitmapSource)Img1.Source;
                var pixels = ToYCbCr(image);
                pixels      = QuantizingMaster.UniformQuantization(pixels, dialog.BlueBits, dialog.GreenBits, dialog.RedBits);
                Img1.Source = ToRGB(pixels, image);
            }
        }
コード例 #2
0
        private void UniformQuantizing_OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new SimpleQuantizingDialog();

            dialog.ShowDialog();
            if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
            {
                var image  = (BitmapSource)Img1.Source;
                var pixels = Img1.Source.ToPixels();
                pixels      = QuantizingMaster.UniformQuantization(pixels, dialog.RedBits, dialog.GreenBits, dialog.BlueBits);
                Img1.Source = BitmapSource.Create(Size, Size, image.DpiX, image.DpiY, image.Format, null, pixels,
                                                  image.PixelWidth * 4);
            }
        }