Esempio n. 1
0
        protected override void DoPreprocessing(FastBitmap bmp)
        {
            for (int y = 0; y < bmp.height; ++y)
            {
                for (int x = 0; x < bmp.width; ++x)
                {
                    Color color = bmp.GetPixel(x, y);
                    rMult += color.R;
                    gMult += color.G;
                    bMult += color.B;
                }
            }
            int pixelCount = bmp.height * bmp.width;

            rMult /= pixelCount;
            gMult /= pixelCount;
            bMult /= pixelCount;
            float avg = (rMult + gMult + bMult) / 3;

            rMult = avg / rMult;
            gMult = avg / gMult;
            bMult = avg / bMult;

            /// Normalizing multipliers
            float max = rMult;

            if (gMult > max)
            {
                max = gMult;
            }
            if (bMult > max)
            {
                max = bMult;
            }
            rMult /= max;
            gMult /= max;
            bMult /= max;
        }
Esempio n. 2
0
 public mainForm()
 {
     InitializeComponent();
     bmp = new FastBitmap(pictureBox.Width, pictureBox.Height);
     changeFiltersEnabled(true);
 }
Esempio n. 3
0
 protected override void DoPreprocessing(FastBitmap bmp)
 {
     xBase = bmp.width / 2;
     yBase = bmp.height / 2;
 }
Esempio n. 4
0
        protected override Color CalculateNewPixelColor(FastBitmap bmp, int x, int y)
        {
            Color source = bmp.GetPixel(x, y);

            return(Color.FromArgb((int)(source.R * rMult), (int)(source.G * gMult), (int)(source.B * bMult)));
        }
Esempio n. 5
0
 protected virtual void DoPreprocessing(FastBitmap bmp)
 {
     return;
 }
Esempio n. 6
0
 protected abstract Color CalculateNewPixelColor(FastBitmap bmp, int x, int y);
Esempio n. 7
0
 protected override Color CalculateNewPixelColor(FastBitmap bmp, int x, int y)
 {
     throw new NotImplementedException();
 }
Esempio n. 8
0
        protected override Color CalculateNewPixelColor(FastBitmap bmp, int x, int y)
        {
            Color source = bmp.GetPixel(x, y);

            return(Color.FromArgb(255 - source.R, 255 - source.G, 255 - source.B));
        }