Example #1
0
        private void FilterWithCorrection(FastBitmapArray /*bitmap*/ array, int x, int y)
        {
            double red   = array.GetRed(x, y);
            double green = array.GetGreen(x, y);
            double blue  = array.GetBlue(x, y);

            double redNew   = FilterRed(red, green, blue);
            double greenNew = FilterGreen(red, green, blue);
            double blueNew  = FilterBlue(red, green, blue);

            if (redNew < 0)
            {
                redNew = 0;
            }
            else if (redNew > 1)
            {
                redNew = 1;
            }
            if (greenNew < 0)
            {
                greenNew = 0;
            }
            else if (greenNew > 1)
            {
                greenNew = 1;
            }
            if (blueNew < 0)
            {
                blueNew = 0;
            }
            else if (blueNew > 1)
            {
                blueNew = 1;
            }

            array.SetPixelBatch(x, y, redNew, greenNew, blueNew);
        }