1 2 public BufferedImage halfFlipW(BufferedImage bi) 3 { 4 int width = bi.getWidth(); 5 int height = bi.getHeight(); 6 7 BufferedImage biFlip = new BufferedImage(width, height, bi.getType()); 8 9 for(int i=0; i<width; i++) 10 for(int j=0; j<height/2; j++) 11 { 12 biFlip.setRGB(i, j, bi.getRGB(i, j)); 13 biFlip.setRGB(i, (height-1)-j, bi.getRGB(i, j)); 14 } 15 16 return biFlip; 17 }
1 2 public BufferedImage halfFlipH(BufferedImage bi) 3 { 4 int width = bi.getWidth(); 5 int height = bi.getHeight(); 6 7 BufferedImage biFlip = new BufferedImage(width, height, bi.getType()); 8 9 for(int i=0; i<width/2; i++) 10 for(int j=0; j<height; j++) 11 { 12 biFlip.setRGB(i, j, bi.getRGB(i, j)); 13 biFlip.setRGB((width-1)-i, j, bi.getRGB(i, j)); 14 } 15 16 return biFlip; 17 }