Exemplo n.º 1
0
        public override void Handle(HighlightContext context, int threshold, float alpha)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            try
            {
                //calculate the highlighted portion stored into image object
                var highlightedImage = Library.ImageHelper.HightlightDifferences(context._unOriginalLeftImage, context._unOriginalRightImage, threshold, alpha);

                //blend the image with the original one
                var highlightLeftImage = Library.ImageHelper.MatrixBlend(context._unOriginalLeftImage, highlightedImage, (byte)128);
                var highlightRightImage = Library.ImageHelper.MatrixBlend(context._unOriginalRightImage, highlightedImage, (byte)128);

                //draw image
                context.originalForm.Invoke(
                    new UpdateImageBoxDelegate(UpdateLeftImgBox),
                    new object[] { highlightLeftImage, context.imageDisplayMode });

                context.originalForm.Invoke(
                    new UpdateImageBoxDelegate(UpdateRightImgBox),
                    new object[] { highlightRightImage, context.imageDisplayMode });

                //release memory from images
                highlightedImage.Dispose();
            }
            catch (Exception ex)
            {
                _logger.Error("Handle exception: " + ex.Message);
                _logger.Error("Handle err Stack: " + ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                _logger.Info("SideBySideState.Handle takes {0}", sw.Elapsed.ToString());
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Handle the highlight logic
 /// </summary>
 /// <param name="context"></param>
 /// <param name="threshold">threshold for diff</param>
 /// <param name="alpha">alpha value for hightlight color</param>
 public abstract void Handle(HighlightContext context, int threshold, float alpha);
Exemplo n.º 3
0
 public override void Handle(HighlightContext context, int threshold, float alpha)
 {
     //do nothing...
 }