J2ME嶄議GIF侃尖窃 - 園殻秘壇利
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-17
protected int frameCount; static class GifFrame { public GifFrame(Image im, int del) { image = im; delay = del; } public Image image; public int delay; } /** * Gets display duration for specified frame. * * @param n * int index of frame * @return delay in milliseconds */ public int getDelay(int n) { delay = -1; if ((n >= 0) && (n < frameCount)) { delay = ((GifFrame) frames.elementAt(n)).delay; } return delay; } /** * Gets the number of frames read from file. * * @return frame count */ public int getFrameCount() { return frameCount; } /** * Gets the first (or only) image read. * * @return BufferedImage containing first frame, or null if none. */ public Image getImage() { return getFrame(0); } /** * Gets the "Netscape" iteration count, if any. A count of 0 means repeat * indefinitiely. * * @return iteration count if one was specified, else 1. */ public int getLoopCount() { return loopCount; } /** * Creates new frame image from current data (and previous frames as * specified by their disposition codes). */ protected void setPixels() { // expose destination image''s pixels as int array int[] dest = new int[width * height]; // fill in starting image contents based on last image''s dispose code if (lastDispose > 0) { if (lastDispose == 3) { // use image before last int n = frameCount - 2; if (n > 0) { lastImage = getFrame(n - 1); } else { lastImage = null; } } if (lastImage != null) { lastImage.getRGB(dest, 0, width, 0, 0, width, height); // copy pixels if (lastDispose == 2) { // fill last image rect area with background color int c = 0; if (!transparency) { c = lastBgColor; } for (int i = 0; i < lrh; i++) { int n1 = (lry + i) * width + lrx; int n2 = n1 + lrw; for (int k = n1; k < n2; k++) { dest[k] = c; } } } } } // copy each source line to the appropriate place in the destination int pass = 1; int inc = 8; int iline = 0; for (int i = 0; i < ih; i++) { int line = i; if (interlace) { if (iline >= ih) { pass++; switch (pass) { case 2: |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于J2ME嶄議GIF侃尖窃 - 園殻秘壇利的所有评论