APNG Specification: Difference between revisions

Jump to navigation Jump to search
iterations->plays
No edit summary
(iterations->plays)
Line 40: Line 40:
To be recognized as an APNG, an `acTL` chunk must appear in the stream before any `IDAT` chunks. The `acTL` structure is described in the next section.
To be recognized as an APNG, an `acTL` chunk must appear in the stream before any `IDAT` chunks. The `acTL` structure is described in the next section.


The default image may be included as the first frame of the animation by the presence of a single `fcTL` chunk before `IDAT`. Otherwise, the default image is not part of the animation, and the output buffer must be completely initialized to fully transparent black rectangle, with width and height dimensions from the `IHDR` chunk, at the beginning of each iteration.
The default image may be included as the first frame of the animation by the presence of a single `fcTL` chunk before `IDAT`. Otherwise, the default image is not part of the animation, and the output buffer must be completely initialized to fully transparent black rectangle, with width and height dimensions from the `IHDR` chunk, at the beginning of each play.


Subsequent frames are encoded in `fdAT` chunks containing almost the same structure of content as `IDAT` chunks. Information for each frame about placement and rendering is stored in `fcTL` chunks.  The full layout of `fdAT` and `fcTL` chunks is described below.
Subsequent frames are encoded in `fdAT` chunks containing almost the same structure of content as `IDAT` chunks. Information for each frame about placement and rendering is stored in `fcTL` chunks.  The full layout of `fdAT` and `fcTL` chunks is described below.
Line 46: Line 46:
The boundaries of the entire animation are specified by the width and height parameters of the PNG `IHDR` chunk, regardless of whether the default image is part of the animation. The default image should be appropriately padded with fully transparent pixels if extra space will be needed for later frames.
The boundaries of the entire animation are specified by the width and height parameters of the PNG `IHDR` chunk, regardless of whether the default image is part of the animation. The default image should be appropriately padded with fully transparent pixels if extra space will be needed for later frames.


Each frame is identical for each iteration, therefore it is safe for applications to cache the frames.
Each frame is identical for each play, therefore it is safe for applications to cache the frames.


== Chunk Sequence Numbers ==
== Chunk Sequence Numbers ==
Line 83: Line 83:
     byte
     byte
       0  num_frames    (unsigned int)    Number of frames
       0  num_frames    (unsigned int)    Number of frames
       4  num_iterations (unsigned int)    Number of times to loop this APNG.  0 indicates infinite looping.
       4  num_plays      (unsigned int)    Number of times to loop this APNG.  0 indicates infinite looping.


`num_frames` indicates the total number of frames in the animation. This must  equal the number of `fcTL` chunks. 0 is not a valid value. 1 is a valid value for a single-frame APNG. If this value does not equal the actual number of frames it should be treated as an error.
`num_frames` indicates the total number of frames in the animation. This must  equal the number of `fcTL` chunks. 0 is not a valid value. 1 is a valid value for a single-frame APNG. If this value does not equal the actual number of frames it should be treated as an error.


`num_iterations` indicates the number of iterations that this animation should play; if it is 0, the animation should play indefinitely.  If nonzero, the animation should come to rest on the final frame at the end of the last iteration. The number of iterations includes the first time the sequence is displayed.
`num_plays` indicates the number of times that this animation should play; if it is 0, the animation should play indefinitely.  If nonzero, the animation should come to rest on the final frame at the end of the last play.


== `fcTL`: The Frame Control Chunk ==
== `fcTL`: The Frame Control Chunk ==
Line 157: Line 157:
* The `width` and `height` fields must equal the corresponding fields from the `IHDR` chunk.
* The `width` and `height` fields must equal the corresponding fields from the `IHDR` chunk.


As noted earlier, if a `fcTL` chunk does not precede `IDAT`, the default image is not part of the animation, and the output buffer must be completely initialized to fully transparent black at the beginning of each iteration.
As noted earlier, if a `fcTL` chunk does not precede `IDAT`, the default image is not part of the animation, and the output buffer must be completely initialized to fully transparent black at the beginning of each play.


Together these requirements serve to ensure that each iteration of the animation will be identical.
Together these requirements serve to ensure that each play of the animation will be identical.


== `fdAT`: The Frame Data Chunk ==
== `fdAT`: The Frame Data Chunk ==
48

edits

Navigation menu