0
点赞
收藏
分享

微信扫一扫

J2ME中的GIF处理类

大南瓜鸭 2023-03-20 阅读 84


用法如下:

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);//循环绘图

}



源码:

  • ​​GIFDecode.rar​​ (4.9 KB)
  • 下载次数: 39
举报

相关推荐

0 条评论