APNG Specification: Difference between revisions

Jump to navigation Jump to search
no edit summary
m (header typo ("Chuck" -> "Chunk"))
No edit summary
Line 41: Line 41:
== `acTl`: The Animation Control Chunk ==
== `acTl`: The Animation Control Chunk ==


The `acTl` chunk is an ancillary chunk as defined in the PNG Specification. It must appear before the first `IDAT` chunk within a valid PNG stream. If the color type of the image is PNG_COLOR_TYPE_PALETTE the `acTl` chunk must appear after the `PLTE` chunk.
The `acTl` chunk is an ancillary chunk as defined in the PNG Specification. It must appear before the first `IDAT` chunk within a valid PNG stream. If the color type of the image is 3 (indexed-color) the `acTl` chunk must appear after the `PLTE` chunk.


The `acTl` chunk contains:
The `acTl` chunk contains:
Line 57: Line 57:
`IHDR_crc` must contain a copy of the CRC from the IHDR chunk. If the two checksums do not match, any further frames must be discarded.
`IHDR_crc` must contain a copy of the CRC from the IHDR chunk. If the two checksums do not match, any further frames must be discarded.


`PLTE_crc` must contain a copy of the CRC from the PLTE chunk if the color type for the PNG is PNG_COLOR_TYPE_PALETTE, and 0 otherwise. If the two checksums do not match, any further frames must be discarded.
`PLTE_crc` must contain a copy of the CRC from the PLTE chunk if the color type for the PNG is 3 (indexed-color), and 0 otherwise. If the two checksums do not match, any further frames must be discarded.


== `fcTl`: The Frame Control Chunk ==
== `fcTl`: The Frame Control Chunk ==
Line 101: Line 101:
                   +---------------------- bit 4: APNG_RENDER_OP_SKIP_FRAME
                   +---------------------- bit 4: APNG_RENDER_OP_SKIP_FRAME


Bits 5 through 7 are reserved and must be set to 0.  Valid values for `dispose_op` are:
Bits 5 through 7 are reserved and must be 0.  Valid values for `dispose_op` are:


     value:
     value:
Line 112: Line 112:
* `APNG_RENDER_OP_DISPOSE_PREVIOUS`: the frame's region is to be reverted to the previous contents.
* `APNG_RENDER_OP_DISPOSE_PREVIOUS`: the frame's region is to be reverted to the previous contents.


`APNG_RENDER_OP_BLEND_FLAG` may be added to any of the above disposal operations.  If this flag is not set, all color components of the frame, including alpha, overwrite the current contents of the frame's canvas region.  If the BLEND_FLAG is set the frame should be composited onto the canvas based on its alpha, using a simple OVER operation:
`APNG_RENDER_OP_BLEND_FLAG` may be added to any of the above disposal operations.  If this flag is 0, all color components of the frame, including alpha, overwrite the current contents of the frame's canvas region.  If the APNG_RENDER_OP_BLEND_FLAG is not 0 the frame should be composited onto the canvas based on its alpha, using a simple OVER operation:


     Csrc - component of pixel in the frame
     Csrc - component of pixel in the frame
Line 123: Line 123:
`APNG_RENDER_OP_BLEND_FLAG` is not valid for color types 0 (greyscale without alpha) or 2 (truecolor without alpha).  It is valid for type 3 (indexed) images; however, the resulting pixel values may not be present in the specified palette.  It is always valid for type 4 (greyscale with alpha) and type 6 (truecolor with alpha) images.
`APNG_RENDER_OP_BLEND_FLAG` is not valid for color types 0 (greyscale without alpha) or 2 (truecolor without alpha).  It is valid for type 3 (indexed) images; however, the resulting pixel values may not be present in the specified palette.  It is always valid for type 4 (greyscale with alpha) and type 6 (truecolor with alpha) images.


If `APNG_RENDER_OP_SKIP_FRAME` is present, then the decoder should not render the current frame as part of the animation.  Though this flag can be set on any frame and must be honored, it is most useful for frame 0, to prevent the frame that would be visible to PNG viewers not supporting animation from being part of the animated frame set.  If animation in the viewer is not desired or explicitly disabled by the user, the viewer should display frame 0 even if `SKIP_FRAME` is set on frame 0.  This provides content authors with a means to provide a still image to be used in lieu of the full animation.
If `APNG_RENDER_OP_SKIP_FRAME` is not 0, then the decoder should not render the current frame as part of the animation.  Though this flag can be set on any frame and must be honored, it is most useful for frame 0, to prevent the frame that would be visible to PNG viewers not supporting animation from being part of the animated frame set.  If animation in the viewer is not desired or is explicitly disabled by the user, the viewer should display frame 0 even if `APNG_RENDER_OP_SKIP_FRAME` is not 0 on frame 0.  This provides content authors with a means to provide a still image to be used in lieu of the full animation.


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

edits

Navigation menu