Browse Source

Use vectors for gaussian blur/sharpen.

Former-commit-id: 9e4f5229abe9f2589802628787a34ff66e63b29f
Former-commit-id: 792bb44a20e76fe1ae47be3f597d5967935a24ac
Former-commit-id: 281e94a6f0c4d30625f1c5be42103de494f6b080
af/merge-core
James Jackson-South 10 years ago
parent
commit
e7cde69b84
  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