Changes

Jump to: navigation, search

APNG Specification

310 bytes added, 16:06, 5 April 2007
Remove restrictions on first fcTL by making clearing mandatory
To be recognized as an APNG, an `acTL` chunk must appear in the stream before any `IDAT` chunks. The `acTL` structure is described below.
Logically, at the beginning of each play the output buffer must be completely initialized to a fully transparent black rectangle, with width and height dimensions from the `IHDR` chunk. 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 a 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, which have the same structure as `IDAT` chunks, except preceded by a sequence number. 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_BACKGROUND: the frame's region of the output buffer is to be cleared to fully transparent black before rendering the next frame.
* APNG_DISPOSE_OP_PREVIOUS: the frame's region of the output buffer is to be reverted to the previous contents before rendering the next frame.
 
If the first `fcTL` chunk uses a `dispose_op` of APNG_DISPOSE_OP_PREVIOUS it should be treated as APNG_DISPOSE_OP_BACKGROUND.
`blend_op` specifies whether the frame is to be alpha blended into the current output buffer content, or whether it should completely replace its region in the output buffer.
If `blend_op` is APNG_BLEND_OP_SOURCE all color components of the frame, including alpha, overwrite the current contents of the frame's output buffer region. If `blend_op` is APNG_BLEND_OP_OVER the frame should be composited onto the output buffer based on its alpha, using a simple OVER operation as described in the "Alpha Channel Processing" section of the PNG specification [PNG-1.2]. Note that Variation 2 of the sample code is applicable.
The Note that for the first `fcTL` chunk has these restrictions:* `blend_op` must be APNG_BLEND_OP_SOURCE* `dispose_op` must not be APNG_DISPOSE_OP_PREVIOUS frame the two blend modes are functionally equivalent due to the clearing of the output buffer at the beginning of each play.
The `fcTL` chunk corresponding to the default image has additional restrictions, if it exists, has these restrictions:
* The `x_offset` and `y_offset` fields must be 0.
* 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 play. Together these requirements serve This is to ensure that each play of the animation will be identical. Decoders are free to avoid an explicit clear step as long as the result is guaranteed to be identical. For example, if the default image is included in the animation, and uses a `blend_op` of APNG_BLEND_OP_SOURCE, clearing is not necessary because the entire output buffer will be overwritten.
== `fdAT`: The Frame Data Chunk ==
18
edits

Navigation menu