Search in sources :

Example 6 with IntHolder

use of argparser.IntHolder in project artisynth_core by artisynth.

the class AnimatedGifWriter method main.

/**
 * Main function
 * Usage: java artisynth.core.moviemaker.AnimatedGifWriter [options] <list of input files> <output file>
 */
public static void main(String[] args) throws Exception {
    DoubleHolder delayHolder = new DoubleHolder(0);
    IntHolder loopHolder = new IntHolder(1);
    String[] left = parseArgs(args, delayHolder, loopHolder);
    if (left == null || left.length < 2) {
        return;
    }
    ArrayList<BufferedImage> imageList = new ArrayList<BufferedImage>(left.length);
    for (int i = 0; i < left.length - 1; i++) {
        try {
            BufferedImage image = ImageIO.read(new File(left[i]));
            imageList.add(image);
        } catch (Exception e) {
            System.err.println("Cannot read " + left[i] + ", ignoring");
        }
    }
    String outputFile = left[left.length - 1];
    if (imageList.size() > 0) {
        write(new File(outputFile), imageList, delayHolder.value, loopHolder.value);
    }
}
Also used : DoubleHolder(argparser.DoubleHolder) IntHolder(argparser.IntHolder) ArrayList(java.util.ArrayList) File(java.io.File) BufferedImage(java.awt.image.BufferedImage) IIOInvalidTreeException(javax.imageio.metadata.IIOInvalidTreeException) IOException(java.io.IOException)

Aggregations

IntHolder (argparser.IntHolder)6 ArgParser (argparser.ArgParser)4 File (java.io.File)4 DoubleHolder (argparser.DoubleHolder)2 StringHolder (argparser.StringHolder)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Point (java.awt.Point)1 WindowEvent (java.awt.event.WindowEvent)1 WindowListener (java.awt.event.WindowListener)1 BufferedImage (java.awt.image.BufferedImage)1 Vector (java.util.Vector)1 IIOInvalidTreeException (javax.imageio.metadata.IIOInvalidTreeException)1 NURBSCurve3d (maspack.geometry.NURBSCurve3d)1 NURBSSurface (maspack.geometry.NURBSSurface)1 PolygonalMesh (maspack.geometry.PolygonalMesh)1 RigidTransform3d (maspack.matrix.RigidTransform3d)1 GLViewer (maspack.render.GL.GLViewer)1 GLVersion (maspack.render.GL.GLViewer.GLVersion)1 StreamGobbler (maspack.util.StreamGobbler)1