首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2ME开发 >

J2ME中的GIF处置类

2012-09-08 
J2ME中的GIF处理类用法如下:private GIFDecode gifd private int ind private int gifCount private Im

J2ME中的GIF处理类
用法如下:

private GIFDecode gifd;
private int ind;
private int gifCount;
private Image frame;

void initGIF() {
  gifd = new GIFDecode();
  gifd.read(this.getClass().getResourceAsStream("/ar.gif"));//载入gif图片
  ind = 0;
  gifCount = gifd.getFrameCount();//获得帧数
  System.out.println("gifCount="+gifCount);
}

void drawProgressBar(Graphics g, int xpos, int ypos, int anchor) {
  frame = gifd.getFrame(ind);
  ind++;
  if (ind >= gifCount) {
   ind = 0;
  }
  g.drawImage(frame, xpos, ypos, anchor);//循环绘图
}

源码:

热点排行