ImageProcessor.Imaging.FastBitmap.GetSumT C# (CSharp) Method

GetSumT() public method

Gets the sum of the pixels in a tilted rectangle of the Integral image.
public GetSumT ( int x, int y, int rectangleWidth, int rectangleHeight ) : long
x int The horizontal position of the rectangle x.
y int The vertical position of the rectangle y.
rectangleWidth int The rectangle's width w.
rectangleHeight int The rectangle's height h.
return long
        public long GetSumT(int x, int y, int rectangleWidth, int rectangleHeight)
        {
            int a = (this.tiltedWidth * (y + rectangleWidth)) + (x + rectangleWidth + 1);
            int b = (this.tiltedWidth * (y + rectangleHeight)) + (x - rectangleHeight + 1);
            int c = (this.tiltedWidth * y) + (x + 1);
            int d = (this.tiltedWidth * (y + rectangleWidth + rectangleHeight)) + (x + rectangleWidth - rectangleHeight + 1);

            return this.tiltedSum[a] + this.tiltedSum[b] - this.tiltedSum[c] - this.tiltedSum[d];
        }