public void Execute(IWorld parameter) { Logger.Debug("Filter Blur"); IImage image = parameter.Image; for (int x = 0; x < image.Width; x++) { for (int y = 0; y < image.Height; y++) { List <IRGBColor> colors = new List <IRGBColor>(); for (int ix = x - this.Level; ix < x + this.Level; ix++) { for (int iy = y - this.Level; iy < y + this.Level; iy++) { if (ix >= 0 && ix < image.Width && iy >= 0 && iy < image.Height) { IRGBColor color = image.GetColor(ix, iy); colors.Add(color); } } } IRGBColor avgColor = RGBColor.Avg(colors.ToArray()); image.SetColor(x, y, avgColor); } } }