| synopsis || return value || arguments || prev || next |

jpx_composition::add_frame

jx_frame * add_frame( int duration, int repeat_count, bool is_persistent)

[Declared in "../apps/compressed_io/jpx.h"]

Go to class description.


Synopsis

Use this function to add a frame, specifying the number of milliseconds ( duration) until the next frame (if any) is to be started. You must call this function at least once to cause a composition box to be written into the JPX file being generated by the jpx_target object which supplied the present interface.

Each frame can be repeated to create simple animations or movies. To make more sophisticated animations, you may need to explicitly add multiple frames. Where a frame is repeated, the layer indices associated with the compositing layers within each frame may either remain fixed, or be advanced in a regular fashion. For more on this, see add_instruction.

You must add at least one instruction to each new frame which you create.


Return Value

The an opaque pointer which should be passed to add_instruction to define the individual compositing layers which will constitute the frame.

Arguments

duration [int]

Time between this frame and the next, measured in milliseconds. If the frame is repeated, this is the time between the repetitions and the time between the last repetition and any frame which follows. You should not specify a zero-valued duration, except possibly for the last frame in the sequence. The duration of the last frame is completely irrelevant.

repeat_count [int]

If 0, the frame is not repeated. Otherwise, this is the number of times the frame is to be repeated. A negative value means that the frame should be repeated indefinitely. This only makes sense for the last frame to be added.

is_persistent [bool]

If true, the compositing instructions in this frame contribute to a background composition which is to be used by all subsequent frames. Otherwise, the instructions in this frame contribute only to the rendering of the frame itself.

Although persistent frames sound like a good idea, you should try to avoid them. One reason for this is that they make it difficult for a player to start from an arbitrary frame in the sequence. Another more insidious reason is that persistent frames make it difficult to do implement quality progressive compositions or dynamic rendering of regions of interest within a large composed image which cannot be fully stored in a buffer. The kdu_region_compositor object goes to a lot of effort to figure out which persistent frames can be ignored in such a rendering process, but it is far better as a content creator to simply avoid the use of persistent frames, or to use only a single persistent background frame.


| top || synopsis || return value || arguments || prev || next |