Пример #1
0
        private ImgDiffCalculator(ImgDiffOptions options)
        {
            _leftPath  = options.LeftFile;
            _rightPath = options.RightFile;

            _left  = Image.FromFile(_leftPath) as Bitmap;
            _right = Image.FromFile(_rightPath) as Bitmap;

            if (_left == null || _right == null)
            {
                throw new NotSupportedException("Image format not supported!");
            }

            if (_left.Size != _right.Size)
            {
                throw new NotSupportedException("Different image sizes are not supported!");
            }

            _diffAlgorithm    = options.DiffAlgorithm;
            _diffHighlighter  = options.Highlighter;
            _progressObserver = options.ProgressObserver;
        }
Пример #2
0
        /// <summary>
        /// Create <see cref="ImgDiffCalculator"/> with <see cref="ImgDiffOptions"/> options
        /// </summary>
        /// <param name="options">Valid <see cref="ImgDiffOptions"/> options</param>
        /// <returns>Instance of <see cref="ImgDiffCalculator"/></returns>
        public static ImgDiffCalculator Create(ImgDiffOptions options)
        {
            options.Validate();

            return(new ImgDiffCalculator(options));
        }