18
edits
Herbyderby (talk | contribs) m (Swap Structure and Terminology sections) |
Herbyderby (talk | contribs) (Move bKGD handling to canvas definition, which is where it makes the most sense.) |
||
| Line 22: | Line 22: | ||
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 "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. | 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. | 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. | 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. | ||
| Line 36: | Line 38: | ||
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 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 | 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 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. | 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 124: | Line 126: | ||
* 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_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 | * APNG_DISPOSE_OP_BACKGROUND: the frame's region of the output buffer is to be cleared to fully transparent black. | ||
* APNG_DISPOSE_OP_PREVIOUS: the frame's region of the output buffer is to be reverted to the previous contents. | * APNG_DISPOSE_OP_PREVIOUS: the frame's region of the output buffer is to be reverted to the previous contents. | ||
| Line 145: | Line 147: | ||
* `dispose_op` must not be APNG_DISPOSE_OP_PREVIOUS | * `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 | 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 fully transparent black at the beginning of each iteration. | ||
Together these requirements serve to ensure that each iteration of the animation will be identical. | Together these requirements serve to ensure that each iteration of the animation will be identical. | ||
edits