/** * Read a control extension. * Return the extension block data. */ byte[] readExtension() { int extensionID = readID(); if (extensionID == GIF_COMMENT_BLOCK_ID) return readCommentExtension(); if (extensionID == GIF_PLAIN_TEXT_BLOCK_ID) return readPlainTextExtension(); if (extensionID == GIF_GRAPHICS_CONTROL_BLOCK_ID) return readGraphicsControlExtension(); if (extensionID == GIF_APPLICATION_EXTENSION_BLOCK_ID) return readApplicationExtension(); // Otherwise, we don't recognize the block. If the // field size is correct, we can just skip over // the block contents. try { int extSize = inputStream.read(); if (extSize < 0) { SWT.error(SWT.ERROR_INVALID_IMAGE); } byte[] ext = new byte[extSize]; inputStream.read(ext, 0, extSize); return ext; } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); return null; } }
palette = readPalette(1 << defaultDepth); } else { int id = readID(); while (id != GIF_TRAILER_ID && id != -1) { if (id == GIF_IMAGE_BLOCK_ID) { ImageData image = readImageBlock(palette); if (loader.hasListeners()) { loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true)); readExtension(); } else { SWT.error(SWT.ERROR_INVALID_IMAGE); id = readID(); // block terminator (0) if (id == 0) id = readID(); // next block ID (unless we just read it)
palette = readPalette(1 << depth); } else { palette = grayRamp(1 << depth);
writePalette(palette, depth); writeGraphicsControlBlock(data[frame]); writePalette(data[frame].palette, depth);
palette = readPalette(1 << depth); } else { palette = grayRamp(1 << depth);
writePalette(palette, depth); writeGraphicsControlBlock(data[frame]); writePalette(data[frame].palette, depth);
/** * Read a control extension. * Return the extension block data. */ byte[] readExtension() { int extensionID = readID(); if (extensionID == GIF_COMMENT_BLOCK_ID) return readCommentExtension(); if (extensionID == GIF_PLAIN_TEXT_BLOCK_ID) return readPlainTextExtension(); if (extensionID == GIF_GRAPHICS_CONTROL_BLOCK_ID) return readGraphicsControlExtension(); if (extensionID == GIF_APPLICATION_EXTENSION_BLOCK_ID) return readApplicationExtension(); // Otherwise, we don't recognize the block. If the // field size is correct, we can just skip over // the block contents. try { int extSize = inputStream.read(); if (extSize < 0) { SWT.error(SWT.ERROR_INVALID_IMAGE); } byte[] ext = new byte[extSize]; inputStream.read(ext, 0, extSize); return ext; } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); return null; } }
palette = readPalette(1 << defaultDepth); } else { int id = readID(); while (id != GIF_TRAILER_ID && id != -1) { if (id == GIF_IMAGE_BLOCK_ID) { ImageData image = readImageBlock(palette); if (loader.hasListeners()) { loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true)); readExtension(); } else { SWT.error(SWT.ERROR_INVALID_IMAGE); id = readID(); // block terminator (0) if (id == 0) id = readID(); // next block ID (unless we just read it)
palette = readPalette(1 << depth); } else { palette = grayRamp(1 << depth);
writePalette(palette, depth); writeGraphicsControlBlock(data[frame]); writePalette(data[frame].palette, depth);
/** * Read a control extension. * Return the extension block data. */ byte[] readExtension() { int extensionID = readID(); if (extensionID == GIF_COMMENT_BLOCK_ID) return readCommentExtension(); if (extensionID == GIF_PLAIN_TEXT_BLOCK_ID) return readPlainTextExtension(); if (extensionID == GIF_GRAPHICS_CONTROL_BLOCK_ID) return readGraphicsControlExtension(); if (extensionID == GIF_APPLICATION_EXTENSION_BLOCK_ID) return readApplicationExtension(); // Otherwise, we don't recognize the block. If the // field size is correct, we can just skip over // the block contents. try { int extSize = inputStream.read(); if (extSize < 0) { SWT.error(SWT.ERROR_INVALID_IMAGE); } byte[] ext = new byte[extSize]; inputStream.read(ext, 0, extSize); return ext; } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); return null; } }
palette = readPalette(1 << defaultDepth); } else { int id = readID(); while (id != GIF_TRAILER_ID && id != -1) { if (id == GIF_IMAGE_BLOCK_ID) { ImageData image = readImageBlock(palette); if (loader.hasListeners()) { loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true)); readExtension(); } else { SWT.error(SWT.ERROR_INVALID_IMAGE); id = readID(); // block terminator (0) if (id == 0) id = readID(); // next block ID (unless we just read it)
palette = readPalette(1 << depth); } else { palette = grayRamp(1 << depth);
writePalette(palette, depth); writeGraphicsControlBlock(data[frame]); writePalette(data[frame].palette, depth);
/** * Read a control extension. * Return the extension block data. */ byte[] readExtension() { int extensionID = readID(); if (extensionID == GIF_COMMENT_BLOCK_ID) return readCommentExtension(); if (extensionID == GIF_PLAIN_TEXT_BLOCK_ID) return readPlainTextExtension(); if (extensionID == GIF_GRAPHICS_CONTROL_BLOCK_ID) return readGraphicsControlExtension(); if (extensionID == GIF_APPLICATION_EXTENSION_BLOCK_ID) return readApplicationExtension(); // Otherwise, we don't recognize the block. If the // field size is correct, we can just skip over // the block contents. try { int extSize = inputStream.read(); if (extSize < 0) { SWT.error(SWT.ERROR_INVALID_IMAGE); } byte[] ext = new byte[extSize]; inputStream.read(ext, 0, extSize); return ext; } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); return null; } }
palette = readPalette(1 << defaultDepth); } else { int id = readID(); while (id != GIF_TRAILER_ID && id != -1) { if (id == GIF_IMAGE_BLOCK_ID) { ImageData image = readImageBlock(palette); if (loader.hasListeners()) { loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true)); readExtension(); } else { SWT.error(SWT.ERROR_INVALID_IMAGE); id = readID(); // block terminator (0) if (id == 0) id = readID(); // next block ID (unless we just read it)
palette = readPalette(1 << depth); } else { palette = grayRamp(1 << depth);
writePalette(palette, depth); writeGraphicsControlBlock(data[frame]); writePalette(data[frame].palette, depth);
/** * Read a control extension. * Return the extension block data. */ byte[] readExtension() { int extensionID = readID(); if (extensionID == GIF_COMMENT_BLOCK_ID) return readCommentExtension(); if (extensionID == GIF_PLAIN_TEXT_BLOCK_ID) return readPlainTextExtension(); if (extensionID == GIF_GRAPHICS_CONTROL_BLOCK_ID) return readGraphicsControlExtension(); if (extensionID == GIF_APPLICATION_EXTENSION_BLOCK_ID) return readApplicationExtension(); // Otherwise, we don't recognize the block. If the // field size is correct, we can just skip over // the block contents. try { int extSize = inputStream.read(); if (extSize < 0) { SWT.error(SWT.ERROR_INVALID_IMAGE); } byte[] ext = new byte[extSize]; inputStream.read(ext, 0, extSize); return ext; } catch (IOException e) { SWT.error(SWT.ERROR_IO, e); return null; } }
palette = readPalette(1 << defaultDepth); } else { int id = readID(); while (id != GIF_TRAILER_ID && id != -1) { if (id == GIF_IMAGE_BLOCK_ID) { ImageData image = readImageBlock(palette); if (loader.hasListeners()) { loader.notifyListeners(new ImageLoaderEvent(loader, image, 3, true)); readExtension(); } else { SWT.error(SWT.ERROR_INVALID_IMAGE); id = readID(); // block terminator (0) if (id == 0) id = readID(); // next block ID (unless we just read it)