Package giftoapng

Source Code of giftoapng.ChunkfcTL

/**
* 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;

/**
* Frame-control-chunk: width&height of related image, offset, delay-time, dispose and blend-method
* For more information look here: <a href="http://wiki.mozilla.org/APNG_Specification">APNG-specifcation</a>
* @author Alexander Sch&auml;ffer
*
*/
public class ChunkfcTL extends Chunk implements iHasSequence {
  private int miSequenceNumber;
  private int miWidth;
  private int miHeight;
  private int miX_Offset;
  private int miY_Offset;
  private short msDelayNum;
  private short msDelayDen;
  private byte mbDisposeOp;
  private byte mbBlendOp;
 
  public static final short APNG_DEF_DELAY_DEN=100;
  public static final byte APNG_BLEND_OP_SOURCE=0;
  public static final byte APNG_BLEND_OP_OVER=1;
 
 
  public ChunkfcTL(int isequenceNumer, int iwidth, int iheight, int ix_offset, int iy_offset,
           int idelaytime, int idisposalmethod,int iblendmethod) {
    mbaHeader=new Property("fcTL");
   
    miSequenceNumber=isequenceNumer;
    miWidth=iwidth;
    miHeight=iheight;
    miX_Offset=ix_offset;
    miY_Offset=iy_offset;
    msDelayNum=(short)idelaytime;
    msDelayDen=APNG_DEF_DELAY_DEN; //always 1/100ths seconds
    mbDisposeOp=(byte)idisposalmethod;
    mbBlendOp=(byte)iblendmethod; 
  }

  @Override
  protected byte[] getData() {
    ByteBuilder bb = new ByteBuilder();
    bb.append(miSequenceNumber);
    bb.append(miWidth);
    bb.append(miHeight);
    bb.append(miX_Offset);
    bb.append(miY_Offset);
    bb.append(msDelayNum);
    bb.append(msDelayDen);
    bb.appendSingle(mbDisposeOp);
    bb.appendSingle(mbBlendOp);
    return bb.getArray();
   
  }

  @Override
  public int getSequenceNumber()
  {
    return miSequenceNumber;
  }
}
TOP

Related Classes of giftoapng.ChunkfcTL

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.