public void fill(BitmapData src, int x, int y, MyFilter.BorderMethod borderMethod) { int startX = x - Size / 2; int startY = y - Size / 2; for (int j = 0; j < Size; j++) { for (int i = 0; i < Size; i++) { _pixels[i, j] = MyFilter.getPixel(src, startX + i, startY + j, borderMethod, 1.0)[0]; } } }
public int fill(BitmapData srx, int x, int y, MyFilter.BorderMethod borderMethod, MyFilter filter) { int size = filter.size; _data = new double[size, size][]; int startX = x - size / 2; int startY = y - size / 2; int pixels = 0; for (int j = 0; j < size; j++) { for (int i = 0; i < size; i++) { _data[i, j] = MyFilter.getPixel(srx, startX + i, startY + j, borderMethod, filter[i, j]); if (_data[i, j] != null) { pixels++; } } } return(pixels); }
private double getP(int x, int y, MyFilter.BorderMethod borderMethod) { switch (borderMethod) { case MyFilter.BorderMethod.NULL: case MyFilter.BorderMethod.ZERO: if (x < 0 || x >= Size || y < 0 || y >= Size) { return(0); } else { return(_pixels[x, y]); } case MyFilter.BorderMethod.NEAR: if (x < 0) { x = 0; } else if (x >= Size) { x = Size - 1; } if (y < 0) { y = 0; } else if (y >= Size) { y = Size - 1; } return(_pixels[x, y]); } return(0); }