Ejemplo n.º 1
0
        public Bitmap Process(Bitmap source, params IPerItemAlgorithm[] perItemAlgorithms)
        {
            LockableBitmap lockableBitmap = new LockableBitmap(source);

            lockableBitmap.LockBits();

            try
            {
                foreach (IPerItemAlgorithm algorithm in perItemAlgorithms)
                {
                    for (int x = 0; x < lockableBitmap.Width; x++)
                    {
                        for (int y = 0; y < lockableBitmap.Height; y++)
                        {
                            Color processedColor = algorithm.Execute(lockableBitmap.GetPixel(x, y));
                            lockableBitmap.SetPixel(x, y, processedColor);
                        }
                    }
                }
            }
            finally
            {
                lockableBitmap.UnlockBits();
            }

            return(source);
        }
Ejemplo n.º 2
0
 private void ProcessOutput(ApertureItem processedApertureItem, Color processedColor, LockableBitmap outBitmap)
 {
     outBitmap.SetPixel(
         processedApertureItem.Coords.X,
         processedApertureItem.Coords.Y,
         processedColor);
 }
Ejemplo n.º 3
0
        private void FillRegion(
            Region region,
            LockableBitmap lockableBitmap)
        {
            Color color;

            if (!ColorMapper.TryMap(region.Number, out color))
            {
                color = colorGenerator.RandomColor();
            }

            foreach (ScanInfo info in region.Infos)
            {
                lockableBitmap.SetPixel(info.Coords.X, info.Coords.Y, color);
            }
        }
Ejemplo n.º 4
0
        private void ApplyPatternValues(IEnumerable <double> processedPattern, LockableBitmap source)
        {
            Color[] colors = processedPattern.Select(BinaryToColor).ToArray();

            int colorIndex = 0;

            for (int x = 0; x < source.Width; x++)
            {
                for (int y = 0; y < source.Height; y++)
                {
                    source.SetPixel(x, y, colors[colorIndex]);

                    colorIndex++;
                }
            }
        }
Ejemplo n.º 5
0
        private void FillRegion(
            int regionIndex,
            KeyValuePair <int, List <ScanInfo> > region,
            LockableBitmap lockableBitmap)
        {
            Color color;

            if (!ColorMapper.TryMap(regionIndex, out color))
            {
                color = colorGenerator.RandomColor();
            }

            foreach (ScanInfo info in region.Value)
            {
                lockableBitmap.SetPixel(info.Coords.X, info.Coords.Y, color);
            }
        }
Ejemplo n.º 6
0
 protected static void ProcessOutput(Aperture aperture, LockableBitmap outBitmap, Color filteredColor)
 {
     outBitmap.SetPixel(aperture.CurrentX, aperture.CurrentY, filteredColor);
 }