CloneCel

Creates a copy of a cel.

Synopsis

CCB * CloneCel (CCB *src, int32 options)

Description

Makes a copy of a CCB, and optionally of the pixels and/or the pixel lookup table (PLUT). The values in the cloned CCB are identical to the source CCB, except that the CCB_LAST flag is set and the ccb_NextPtr field is NULL in the clone.

The options parameter is one or more of the following values, ORed together as necessary: CLONECEL_CCB_ONLY, CLONECEL_COPY_PIXELS, CLONECEL_COPY_PLUT.

When COPY_PIXELS is specified, a new cel data buffer is allocated, and the pixels in the source (src) cel's buffer are copied to the new buffer.

When COPY_PIXELS is not specified, the new cels ccb_SourcePtr field points to the source cel's data buffer.

When COPY_PLUT is specified, a new PLUT is allocated, and the values from the src cel's PLUT are copied to the new PLUT.

When COPY_PLUT is not specified, the new cels ccb_PLUTPtr field points to the source cel's PLUT. If the cel is uncoded, the COPY_PLUT option has no effect.

You may change any of the values in the CCB fields of the newly created cel. Be careful about changing preamble words when the CCB_CCBPRE flag is not set and the CLONECEL_COPY_PIXELS option was not used. In that situation, the preamble words you change would be those belonging to the original cel, not the copy.

Use DeleteCel() to release all resources allocated for the clone.

Arguments

src
Pointer to a cel to copy.
options
Bitmapped options, as described above.

Return Value

Pointer to the new CCB, or NULL if there is not enough memory to make the clone.

Implementation

Library call implemented in lib3do.lib.

Associated Files

lib3do.lib, celutils.h

See Also

CreateCel, DeleteCel