CreateBackdropCel

Creates a single-color cel.

Synopsis

CCB * CreateBackdropCel (int32 width, int32 height, int32 color, int32 opacityPercent)

Description

Creates a single-colored cel which is useful in serving as a backdrop and/or control point for other objects.

The color is an RGB555-format value. Use the MakeRGB15() macro to create this value from separate red, green, and blue values.

The cel can be opaque or translucent as specified by opacityPercent. 100 percent is opaque, smaller values give translucent cels where the cel's color intensity is the specified percentage of the projected result. For example, 75% means the projected pixels are 75% of the cel's color, 25% of the existing pixel's color. There are actually only eight levels of translucency available; the percentage you request is mapped to the closest available level. The opacity and color of the cel cannot be changed by this function after the cel is created.

An opacityPercent of zero results in a virtual cel, which does not project any pixels when drawn. The CCB_SKIP flag is set when opacityPercent is zero. A cel of this sort is useful in anchoring a list of related cels. It can serve as a single point of control for moving, centering, mapping, and other projection-related manipulations when used with the Library call implemented in lib3do.lib.s that manipulate lists of cels as if they were a single entity.

Regardless of the sizes you specify, the cel requires only sizeof(CCB) bytes of memory. The cel is created with a source size of 1x1 pixel, and the HDX and VDY fields are set to project the pixel to the specified width and height. Note that the ccb_Width and ccb_Height fields reflect the cel's source data size of 1x1pixel. Library call implemented in lib3do.lib.s that are sensitive to cel size, such as centering functions, use SRectFromCel() to get the projected cel size and thus work correctly. You should do the same if you need to obtain the projected cel size programmatically.

You may remap the cel to project to any position, size, and shape you desire after it is created.

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

Arguments

width
Width of the cel as it is to appear when projected.
height
Height of the cel as it is to appear when projected.
color
Color of the cel, in RGB555 format.
opacityPercent
Opacity percentage, from 0 (invisible) to 100 (opaque).

Return Value

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

Implementation

Library call implemented in lib3do.lib.

Associated Files

lib3do.lib, celutils.h

See Also

CreateCel, DeleteCel