예제 #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;
        }
예제 #2
0
파일: Form1.cs 프로젝트: RukhovichIV/CG_1
 public mainForm()
 {
     InitializeComponent();
     bmp = new FastBitmap(pictureBox.Width, pictureBox.Height);
     changeFiltersEnabled(true);
 }
예제 #3
0
 protected override void DoPreprocessing(FastBitmap bmp)
 {
     xBase = bmp.width / 2;
     yBase = bmp.height / 2;
 }
예제 #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)));
        }
예제 #5
0
파일: Filter.cs 프로젝트: RukhovichIV/CG_1
 protected virtual void DoPreprocessing(FastBitmap bmp)
 {
     return;
 }
예제 #6
0
파일: Filter.cs 프로젝트: RukhovichIV/CG_1
 protected abstract Color CalculateNewPixelColor(FastBitmap bmp, int x, int y);
예제 #7
0
 protected override Color CalculateNewPixelColor(FastBitmap bmp, int x, int y)
 {
     throw new NotImplementedException();
 }
예제 #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));
        }