Browse Source

Use vectors for gaussian blur/sharpen.

Former-commit-id: 7daa8a1a37b5aa793b0273a097e8d08cf21a381d
Former-commit-id: 7f213693822645fe4922140b9bd81d15d2efccd1
Former-commit-id: ed5dbdb6e13eb3fe066808d9cb8ba8b5d039bcf9
af/merge-core
James Jackson-South 10 years ago
parent
commit
e5954b9c99
  1. 13
      src/ImageProcessor/Filters/Convolution/Convolution2PassFilter.cs

13
src/ImageProcessor/Filters/Convolution/Convolution2PassFilter.cs

@ -80,10 +80,7 @@ namespace ImageProcessor.Filters
{
for (int x = startX; x < endX; x++)
{
float red = 0;
float green = 0;
float blue = 0;
float alpha = 0;
Color destination = new Color();
// Apply each matrix multiplier to the color components for each pixel.
for (int fy = 0; fy < kernelHeight; fy++)
@ -101,15 +98,11 @@ namespace ImageProcessor.Filters
offsetX = offsetX.Clamp(0, maxX);
Color currentColor = source[offsetX, offsetY];
red += kernel[fy, fx] * currentColor.R;
green += kernel[fy, fx] * currentColor.G;
blue += kernel[fy, fx] * currentColor.B;
alpha += kernel[fy, fx] * currentColor.A;
destination += kernel[fy, fx] * currentColor;
}
}
target[x, y] = new Color(red, green, blue, alpha);
target[x, y] = destination;
}
}
});

Loading…
Cancel
Save