/**
* Copyright: t3am_C9 (Alexander Schäffer, Johannes Ebersold, Sebastian Geib, Thomas Kisiel)
*
* This file is part of GifToApngConverter
*
* GifToApngConverter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GifToApngConverter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GifToApngConverter. If not, see <a href="http://www.gnu.org/licenses/">here</a>
*/
package giftoapng;
import util.ByteBuilder;
/**
* Animation-control-chunk: holds the number of frames and the number of iterations(loops)
* For more information look here: <a href="http://wiki.mozilla.org/APNG_Specification">APNG-specifcation</a>
* @author Alexander Schäffer
*
*/
public class ChunkacTL extends Chunk {
public static final int INFINITE_LOOP=0;
private int miNumFrames=0;
private int miNumLoops=INFINITE_LOOP;
public ChunkacTL(int iNumLoops){
mbaHeader=new Property("acTL");
miNumLoops=iNumLoops;
if(miNumLoops<0){
miNumLoops=INFINITE_LOOP;
}
}
@Override
protected byte[] getData() {
ByteBuilder bb = new ByteBuilder();
bb.append(miNumFrames);
bb.append(miNumLoops);
return bb.getArray();
}
public void setNumFrames(int numFrames){
miNumFrames=numFrames;
}
}