Examples of AnimatedGifEncoder


Examples of org.ajax4jsf.resource.image.animatedgif.AnimatedGifEncoder

      int numberOfFrames = getNumberOfFrames();
      BufferedImage frame = null;
      currFrameIndex = 0;
      if (frameSize.getHeight() > 0.0 && frameSize.getWidth() > 0.0
          && numberOfFrames > 0) {
        AnimatedGifEncoder encoder = new AnimatedGifEncoder();
        encoder.start(output);
        encoder.setRepeat(getRepeat());
        int[] delays = getFrameDelays();
        ImageRenderer renderer = (ImageRenderer) getRenderer(null);
        while (currFrameIndex < numberOfFrames) {
          frame = renderer.createImage(frameSize.width,
              frameSize.height);
          Graphics2D graphics = frame.createGraphics();
          paint(context, graphics, currFrameIndex++);
          graphics.dispose();
          encoder.addFrame(frame);
          if (delays != null && delays.length > currFrameIndex) {
            encoder.setDelay(delays[currFrameIndex]);
          }
        }
        encoder.finish();
      }
      output.flush();
      output.close();
    } catch (IOException e) {
      // TODO Auto-generated catch block
View Full Code Here

Examples of org.nutz.repo.gif.AnimatedGifEncoder

     */
    public static boolean writeGif(String targetFile,
                                   String[] frameFiles,
                                   int delay) {
        try {
            AnimatedGifEncoder e = new AnimatedGifEncoder();
            e.setRepeat(0);
            e.start(targetFile);
            for (String f : frameFiles) {
                e.setDelay(delay);
                e.addFrame(ImageIO.read(new File(f)));
            }
            return e.finish();
        }
        catch (Exception e) {
            return false;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.