示例#1
0
        private Argb GetColor(int row, int col)
        {
            Argb result = new Argb();

            if (row < 0)
            {
                row = 0;
            }
            if (col < 0)
            {
                col = 0;
            }
            if (row >= _height)
            {
                row = _height - 1;
            }
            if (col >= _width)
            {
                col = _width - 1;
            }
            int offset = row * _stride + col * 4;

            result.B = _rgbData[offset];
            result.G = _rgbData[offset + 1];
            result.R = _rgbData[offset + 2];
            result.A = _rgbData[offset + 3];
            return(result);
        }
示例#2
0
 private void PutColor(int row, int col, Argb color)
 {
     var offset = Offset(row, col, _stride);
     _result[offset] = color.B;
     _result[offset + 1] = color.G;
     _result[offset + 2] = color.R;
     _result[offset + 3] = color.A;
 }
示例#3
0
 private void PutColor(int row, int col, Argb color)
 {
     int offset = row * _stride + col * 4;
     _result[offset] = Argb.ToByte(color.B);
     _result[offset + 1] = Argb.ToByte(color.G);
     _result[offset + 2] = Argb.ToByte(color.R);
     _result[offset + 3] = Argb.ToByte(color.A);
 }
示例#4
0
        private void PutColor(int row, int col, Argb color)
        {
            var offset = Offset(row, col, _stride);

            _result[offset]     = color.B;
            _result[offset + 1] = color.G;
            _result[offset + 2] = color.R;
            _result[offset + 3] = color.A;
        }
示例#5
0
        private void PutColor(int row, int col, Argb color)
        {
            int offset = row * _stride + col * 4;

            _result[offset]     = Argb.ToByte(color.B);
            _result[offset + 1] = Argb.ToByte(color.G);
            _result[offset + 2] = Argb.ToByte(color.R);
            _result[offset + 3] = Argb.ToByte(color.A);
        }
示例#6
0
 private Argb GetColor(int row, int col)
 {
     Argb result = new Argb();
     if (row < 0) row = 0;
     if (col < 0) col = 0;
     if (row >= _height) row = _height - 1;
     if (col >= _width) col = _width - 1;
     int offset = row * _stride + col * 4;
     result.B = _rgbData[offset];
     result.G = _rgbData[offset + 1];
     result.R = _rgbData[offset + 2];
     result.A = _rgbData[offset + 3];
     return result;
 }
示例#7
0
 private void DoSmooth(int row, int col)
 {
     Argb sum = new Argb();
     for (int y = -1; y < 2; y++)
     {
         for (int x = -1; x < 2; x++)
         {
             Argb inValue = GetColor(row + y, col + x);
             sum.A += inValue.A;
             sum.B += inValue.B;
             sum.G += inValue.G;
             sum.R += inValue.R;
         }
     }
     sum.A = sum.A / 9;
     sum.B = sum.B / 9;
     sum.G = sum.G / 9;
     sum.R = sum.R / 9;
     PutColor(row, col, sum);
 }
示例#8
0
 private void DoSmooth(int row, int col)
 {
     int a = 0, b = 0, g = 0, r = 0;
     for (int y = -1; y < 2; y++)
     {
         for (int x = -1; x < 2; x++)
         {
             var inValue = GetColor(row + y, col + x);
             a += inValue.A;
             b += inValue.B;
             g += inValue.G;
             r += inValue.R;
         }
     }
     a = a / 9;
     b = b / 9;
     g = g / 9;
     r = r / 9;
     var sum = new Argb(a, r, g, b);
     PutColor(row, col, sum);
 }
示例#9
0
        private void DoSmooth(int row, int col)
        {
            Argb sum = new Argb();

            for (int y = -1; y < 2; y++)
            {
                for (int x = -1; x < 2; x++)
                {
                    Argb inValue = GetColor(row + y, col + x);
                    sum.A += inValue.A;
                    sum.B += inValue.B;
                    sum.G += inValue.G;
                    sum.R += inValue.R;
                }
            }
            sum.A = sum.A / 9;
            sum.B = sum.B / 9;
            sum.G = sum.G / 9;
            sum.R = sum.R / 9;
            PutColor(row, col, sum);
        }
示例#10
0
文件: Smoother.cs 项目: qingqibing/aa
        private void DoSmooth(int row, int col)
        {
            int a = 0, b = 0, g = 0, r = 0;

            for (int y = -1; y < 2; y++)
            {
                for (int x = -1; x < 2; x++)
                {
                    var inValue = GetColor(row + y, col + x);
                    a += inValue.A;
                    b += inValue.B;
                    g += inValue.G;
                    r += inValue.R;
                }
            }
            a = a / 9;
            b = b / 9;
            g = g / 9;
            r = r / 9;
            var sum = new Argb(a, r, g, b);

            PutColor(row, col, sum);
        }