java图像分法集合.docVIP

  • 2
  • 0
  • 约 11页
  • 2016-10-12 发布于贵州
  • 举报
java图像分法集合

import java.awt.*; import javax.swing.*; class ImageTest extends JFrame { public ImageTest() { setSize(300,300); setVisible(true); } public Image[] splitImage(String file, int rows, int cols) { System.out.println(Test); Image t=new ImageIcon(file).getImage(); Image[] result = new Image[rows * cols]; int w = t.getWidth(this)/cols; int h = t.getHeight(this)/rows; try { for(int i = 0;iresult.length;i++) { result[i] = this.createImage(w,h); Graphics g = result[i].getGraphics(); g.translate((-i%cols)*w,(-i/cols)*h); g.drawImage(t,0,0,this); System.out.println(Test); } } catch(Exce

文档评论(0)

1亿VIP精品文档

相关文档