APNG Specification: Difference between revisions

Jump to navigation Jump to search
add a section on error handling
(OVER color type restriction does not take into account possibility of tRNS chunk, and doesn't serve any useful purpose anyway)
(add a section on error handling)
Line 29: Line 29:


For purposes of chunk descriptions, an "unsigned int" shall be a 32-bit unsigned integer in network byte order limited to the range 0 to (2^31)-1; an "unsigned short" shall be a 16-bit unsigned integer in network byte order; a "byte" shall be an 8-bit unsigned integer.
For purposes of chunk descriptions, an "unsigned int" shall be a 32-bit unsigned integer in network byte order limited to the range 0 to (2^31)-1; an "unsigned short" shall be a 16-bit unsigned integer in network byte order; a "byte" shall be an 8-bit unsigned integer.
== Error Handling ==
APNG is designed to allow incremental display of frames before the entire image has been read. This implies that some errors may not be detected until partway through the animation. It is recommended that when an error is encountered decoders should discard all subsequent frames, stop the animation, and revert to displaying the placeholder image if possible. An error may be displayed to the user if appropriate.


= Structure =
= Structure =
Line 79: Line 83:
       4  num_iterations (unsigned int)    Number of times to loop this APNG.  0 indicates infinite looping.
       4  num_iterations (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 should equal the number of `fcTL` chunks. 0 is not a valid value. 1 is a valid value for a single-frame APNG. In case this number does not match the actual number of frames, behaviour of the implementation is not specified.
`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.
`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.
18

edits

Navigation menu