Posted By

whitetiger on 11/09/06


Tagged

image jpg java rotate filter images Converter RGB j2me gray flip half zoom


Versions (?)

Java - FlipH / FlipW


 / Published in: Java
 

  1. public BufferedImage flipH(BufferedImage bi)
  2. {
  3. int width = bi.getWidth();
  4. int height = bi.getHeight();
  5.  
  6. BufferedImage biFlip = new BufferedImage(width, height, bi.getType());
  7.  
  8. for(int i=0; i<width; i++)
  9. for(int j=0; j<height; j++)
  10. biFlip.setRGB((width-1)-i, j, bi.getRGB(i, j));
  11.  
  12. return biFlip;
  13. }
  14.  
  15.  
  16. public BufferedImage flipW(BufferedImage bi)
  17. {
  18. int width = bi.getWidth();
  19. int height = bi.getHeight();
  20.  
  21. BufferedImage biFlip = new BufferedImage(width, height, bi.getType());
  22.  
  23. for(int i=0; i<width; i++)
  24. for(int j=0; j<height; j++)
  25. biFlip.setRGB(i, (height-1)-j, bi.getRGB(i, j));
  26.  
  27. return biFlip;
  28. }

Report this snippet  

You need to login to post a comment.