# Fundamentals of Cel Manipulation

This section summarizes some background information about 3DO cels. It discusses:

- The CCB Structure
- Frequently Accessed CCB Fields

### For More Information

To successfully work with cels, it is essential you read the relevant chapters in the 3DO Graphics Programmer's Guide.

## The CCB Structure

The example below shows the structure definition for a CCB, taken from graphics.h (part of the 3DO development environment #include files). The comments explaining the different types are not in the header file, but are included here for your information.

Caution: The datatypes of the different fields differ; a common source of programming problems.

Example 1: The CCB structure

``

    typedef struct CCB {
        uint32 ccb_Flags;
        struct CCB *ccb_NextPtr;
        CelData *ccb_SourcePtr;
        void *ccb_PLUTPtr;

        Coord ccb_XPos;                        /*16.16 (not int32!)*/
        Coord ccb_YPos;                        /*16.16 (not int32!)*/
        int32 ccb_HDX;                        /*12.20*/
        int32 ccb_HDY;                        /*12.20*/
        int32 ccb_VDX;                        /*16.16*/
        int32 ccb_VDY;                        /*16.16*/
        int32 ccb_HDDX;                        /*12.20, increment for drawing
    */
        int32 ccb_HDDY;                        /*12.20, increment for drawing
    */
        uint32 ccb_PIXC;                        /*P-Mode bit*/

        uint32 ccb_PRE0;                        /*preamble*/
        uint32 ccb_PRE1;                        /**preamble*/

        int32 ccb_Width;                    /*don't change, change position
    instead*
        int32 ccb_Height;                    /*don't change, change position
    instead*/
    } CCB;

### For More Information

A detailed discussion of the CCB is provided in Chapter 5, "Using the Cel Engine," of the 3DO Portfolio Graphics Programmer's Guide.

## Frequently Accessed CCB Fields

About one-third of the fields in the CCB pertain to the cel's basic source data.

- `ccb_SourcePtr`-a pointer to the data

- `ccb_PLUTPtr`-a pointer to the palette

- `ccb_PRE0` and `ccb_PRE1`-two possible "preamble words" that store extra data in some cel formats

- `ccb_Width` and `ccb_Height`-the width and height of the source data

- `ccb_XPos` and `ccb_YPos`-the location of the upper-left corner of the cel

You can do a lot of cel manipulation by directly setting the values of the fields. For example, you can use a simple graphic of two parallel lines to create a laser beam effect. The program stretches the parallel lines from the origin to the bottom left and right corners of the screen by changing the value of `ccB_Width` and `ccB_Height`. This gives the illusion of the beam in the jsanimation program.