code: public static BufferedImage twistImage(BufferedImage srcBmp, int width, int height, boolean bXDir) {
  		double dMultValue = getRandomDouble(1, 3);
  		double dPhase = getRandomDouble(0, PI2);
  
  		if (width > srcBmp.getWidth())
  			width = srcBmp.getWidth();
  		if (height > srcBmp.getHeight())
  			height = srcBmp.getHeight();
  
  		BufferedImage destBmp = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
  
  		Graphics g = destBmp.getGraphics();
  
  		// 设定背景色
  		g.setColor(Color.white);
  		g.fillRect(0, 0, width, height);
  
  		// 画边框
  		g.setColor(Color.black);
  		g.drawRect(0, 0, width - 1, height - 1);
  
  		g.dispose();
  
  		double dBaseAxisLen = bXDir ? (double) height : (double) width;
  
  		for (int i = 1; i < width - 1; i++) {
  			for (int j = 1; j < height - 1; j++) {
  				double dx = 0;
  				dx = bXDir ? (PI2 * (double) j) / dBaseAxisLen : (PI2 * (double) i) / dBaseAxisLen;
  				dx += dPhase;
  				double dy = Math.sin(dx);
  
  				// 取得当前点的颜色
  				int nOldX = 0, nOldY = 0;
  				nOldX = bXDir ? i + (int) (dy * dMultValue) : i;
  				nOldY = bXDir ? j : j + (int) (dy * dMultValue);
  
  				int color = srcBmp.getRGB(i, j);
  				if (nOldX >= 1 && nOldX < width - 1 && nOldY >= 1 && nOldY < height - 1) {
  					destBmp.setRGB(nOldX, nOldY, color);
  				}
  			}
  		}
  
  		return destBmp;
  	}
docs: 扭曲图片
  
  @param srcBmp
  @param bXDir
  @return