//@Override public Image process(Image imageIn) { int width = imageIn.getWidth(); int height = imageIn.getHeight(); Image clone = imageIn.clone(); int r = 0, g = 0, b = 0; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int k = NoiseFilter.getRandomInt(1, 123456); //像素块大小 int dx = x + k % 19; int dy = y + k % 19; if (dx >= width) { dx = width - 1; } if (dy >= height) { dy = height - 1; } r = clone.getRComponent(dx, dy); g = clone.getGComponent(dx, dy); b = clone.getBComponent(dx, dy); imageIn.setPixelColor(x, y, r, g, b); } } return(imageIn); }
//@Override public Image process(Image imageIn) { int width = imageIn.getWidth(); int height = imageIn.getHeight(); Image clone = imageIn.clone(); int r = 0, g = 0, b = 0; int ratio = imageIn.getWidth() > imageIn.getHeight() ? imageIn.getHeight() * 32768 / imageIn.getWidth() : imageIn.getWidth() * 32768 / imageIn.getHeight(); // Calculate center, min and max int cx = imageIn.getWidth() >> 1; int cy = imageIn.getHeight() >> 1; int max = cx * cx + cy * cy; int min = (int)(max * (1 - Size)); int diff = max - min; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { // Calculate distance to center and adapt aspect ratio int dx = cx - x; int dy = cy - y; if (imageIn.getWidth() > imageIn.getHeight()) { dy = (dy * ratio) >> 14; } else { dx = (dx * ratio) >> 14; } int distSq = dx * dx + dy * dy; if (distSq > min) { int k = NoiseFilter.getRandomInt(1, 123456); //像素块大小 int pixeldx = x + k % 19; int pixeldy = y + k % 19; if (pixeldx >= width) { pixeldx = width - 1; } if (pixeldy >= height) { pixeldy = height - 1; } r = clone.getRComponent(pixeldx, pixeldy); g = clone.getGComponent(pixeldx, pixeldy); b = clone.getBComponent(pixeldx, pixeldy); imageIn.setPixelColor(x, y, r, g, b); } } } return(imageIn); }
//@Override public Image process(Image imageIn) { int width = imageIn.getWidth(); int height = imageIn.getHeight(); Image clone = imageIn.clone(); int r = 0, g = 0, b = 0, xx = 0, yy = 0; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int pos = NoiseFilter.getRandomInt(1, 10000) % Model; xx = (x + pos) < width ? (x + pos) : (x - pos) >= 0 ? (x - pos) : x; yy = (y + pos) < height ? (y + pos) : (y - pos) >= 0 ? (y - pos) : y; r = clone.getRComponent(xx, yy); g = clone.getGComponent(xx, yy); b = clone.getBComponent(xx, yy); imageIn.setPixelColor(x, y, r, g, b); } } return(imageIn); }
public Image process(Image imageIn) { int r, g, b, m_current = 0; int width = imageIn.getWidth(); int height = imageIn.getHeight(); Image clone = imageIn.clone(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { if (x == 0) { m_current = (NoiseFilter.getRandomInt(-255, 0xff) % _amount) * ((NoiseFilter.getRandomInt(-255, 0xff) % 2 > 0) ? 1 : -1); } int sx = (int)Function.FClamp(x + m_current, 0, width - 1); r = clone.getRComponent(sx, y); g = clone.getGComponent(sx, y); b = clone.getBComponent(sx, y); imageIn.setPixelColor(x, y, r, g, b); } } return(imageIn); }