Exemple #1
0
        public static MapState[,] ExploreMap(PixelColor[,] pixels)
        {
            var comparer   = new TolerancePixelComparer(20, Color.FromRgb(255, 255, 255));
            var mapBuilder = new ExplorationMapBuilder();
            var map        = mapBuilder.GetExplorationMap(comparer, pixels);

            return(map);
        }
        public void ExecuteProcessImage()
        {
            Processing = true;

            // Load the map from the UI
            var pixels = _mapBuilder
                         .GetPixels(Image);

            // NOTE: Move to factory? Long term plan is to provide some kind of specification.
            var comparer = new TolerancePixelComparer(
                _tolerance, _color);

            // Kick off a task to process the image, and handle the completed callback on the UI thread.
            var task = _imageProcessor
                       .ProcessImage(comparer, pixels)
                       .ContinueWith(ProcessImageComplete, TaskScheduler.FromCurrentSynchronizationContext());
        }