J2ME嶄議GIF侃尖窃 - 園殻秘壇利
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-17
iline = 4; break; case 3: iline = 2; inc = 4; break; case 4: iline = 1; inc = 2; } } line = iline; iline += inc; } line += iy; if (line < height) { int k = line * width; int dx = k + ix; // start of line in dest int dlim = dx + iw; // end of dest line if ((k + width) < dlim) { dlim = k + width; // past dest edge } int sx = i * iw; // start of line in source while (dx < dlim) { // map color and insert in destination int index = ((int) pixels[sx++]) & 0xff; int c = act[index]; if (c != 0) { dest[dx] = c; } dx++; } } } image = Image.createRGBImage(dest, width, height, false); } /** * Gets the image contents of frame n. * * @return BufferedImage representation of frame, or null if n is invalid. */ public Image getFrame(int n) { Image im = null; if ((n >= 0) && (n < frameCount)) { im = ((GifFrame) frames.elementAt(n)).image; } return im; } /** * Reads GIF image from stream * * @param BufferedInputStream * containing GIF file. * @return read status code (0 = no errors) */ public int read(InputStream is) { init(); if (is != null) { in = is; readHeader(); if (!err()) { readContents(); if (frameCount < 0) { status = STATUS_FORMAT_ERROR; } } } else { status = STATUS_OPEN_ERROR; } try { is.close(); } catch (Exception e) { e.printStackTrace(); } return status; } /** * Decodes LZW image data into pixel array. Adapted from John Cristy''s * ImageMagick. */ protected void decodeImageData() { int NullCode = -1; int npix = iw * ih; int available, clear, code_mask, code_size, end_of_information, in_code, old_code, bits, code, count, i, datum, data_size, first, top, bi, pi; if ((pixels == null) || (pixels.length < npix)) { pixels = new byte[npix]; // allocate new pixel array } if (prefix == null) { prefix = new short[MaxStackSize]; } if (suffix == null) { suffix = new byte[MaxStackSize]; } if (pixelSta |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于J2ME嶄議GIF侃尖窃 - 園殻秘壇利的所有评论