Changes

Jump to: navigation, search

APNG Specification

150 bytes added, 02:09, 23 March 2007
Move bKGD handling to canvas definition, which is where it makes the most sense.
The "placeholder image" is the image described by the standard `IDAT` chunks, and is the image that displayed by decoders that do not support APNG.
The "canvas" is the area on the output device on which the frames are to be displayed. The contents of the canvas are not necessarily available to the decoder. As per the PNG Specification, if a `bKGD` chunk exists it may be used to fill the canvas if there is no preferrable background.
The "output buffer" is a pixel array with dimensions specified by the width and height parameters of the PNG IHDR chunk. Conceptually, each frame is constructed in the output buffer before being composited onto the canvas. The contents of the output buffer are available to the decoder. The corner pixels of the output buffer are mapped to the corners of the canvas.
 
"Fully transparent black" means red, green, blue and alpha components are all set to zero.
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.
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 placeholder image may be treated as the first frame of the animation by the presence of a single `fcTL` chunk before `IDAT`. Otherwise, the placeholder image is not part of the animation, and the output buffer must be completely initialized to RGBA(0,0,0,0) fully transparent black at the beginning of each iteration.
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.
* APNG_DISPOSE_OP_NONE: no disposal is done on this frame before rendering the next; its contents are left on the output buffer.
* APNG_DISPOSE_OP_BACKGROUND: the frame's region of the output buffer is to be cleared to the background color. If no bKGD chunk is specified, the result is fully transparent black (r, g, b, and a all 0).
* APNG_DISPOSE_OP_PREVIOUS: the frame's region of the output buffer is to be reverted to the previous contents.
* `dispose_op` must not be APNG_DISPOSE_OP_PREVIOUS
As noted earlier, if a `fcTL` chunk does not precede `IDAT`, the placeholder image is not part of the animation, and the output buffer must be completely initialized to RGBA(0,0,0,0) fully transparent black at the beginning of each iteration.
Together these requirements serve to ensure that each iteration of the animation will be identical.
18
edits

Navigation menu