Example #1
0
        private void LoadWritableBitamp(BitmapSource bitmap, bool IsWindowInit)
        {
            SourceImageWB = new WriteableBitmap(bitmap);
            DestImageWB   = new WriteableBitmap(bitmap);

            int width  = SourceImageWB.PixelWidth;
            int height = SourceImageWB.PixelHeight;

            SourceImageControl.Source = SourceImageWB;
            SourceImageControl.Width  = width;
            SourceImageControl.Height = height;

            DestImageControl.Source = DestImageWB;
            DestImageControl.Width  = width;
            DestImageControl.Height = height;

            SourceImageColorArray = new SimpleColor[height, width];
            DestImageColorArray   = new SimpleColor[height, width];


            Paint.ReadColorsFromBitmap(SourceImageWB, SourceImageColorArray);
            OriginalSourceImageColorArray = (SimpleColor[, ])SourceImageColorArray.Clone();

            if (IsWindowInit == false)
            {
                ColorProfileConverter.ConvertImage(SourceImageColorArray, DestImageColorArray, (ColorProfileEnum)SourceColorSpaceComboBox.SelectedIndex, (ColorProfileEnum)DestColorSpaceComboBox.SelectedIndex);
                Paint.CopyToWriteableBitmap(DestImageWB, DestImageColorArray);
            }
            else
            {
                TryGenerate();
            }
        }