CK_Bitmap | +----CK_Animation
The CK_Animation class represents a displayable animation running at a specified frame rate, and it's state can be either started or stopped.
A CK_Animation is a CK_Bitmap. This allows it to be used as a property in any CK_Component that uses a bitmap property.
A CK_Animation object contains a reference to a CK_AnimatedBitmap. Many CK_Animation objects can reference the same CK_AnimatedBitmap. The CK_AnimatedBitmap is simply a storage container for the image data. The CK_Animation contains the frame rate, as well as the current state: whether the animation is stopped or running, and the index of the frame that is currently visible.
Depending on how the CK_Animation is created, it may or may not have ownership of the CK_AnimatedBitmap. The programmer can decide whether a given CK_Animation owns its CK_AnimatedBitmap. Objects that own other objects will delete the owned objects when they themselves are deleted.
Creates a CK_Animation from a graphics file (.pcx or .bmp) where the frames of the animation are organized in rows and columns. The figure below shows one possible layout of frames for an animation with 10 frames.
- Return Value
- Returns a pointer to the CK_Animation object created.
Parameters
- fileName
- The file (.pcx or .bmp) containing a grid of frames.
- nColumns
- The number of columns in the grid.
- frameWidth
- The width in pixels of each frame.
- frameHeight
- The height in pixels of each frame.
- numFrames
- The total number of frames in the animation. This does not need to be evenly divisible by the number of columns, as demonstrated in the example above.
Remarks
This factory method internally creates a CK_AnimatedImage that is used to create the CK_Animation. The animated image is owned by the animation, and is deleted when the animation is deleted.
This is the most common way to create a CK_Animation. The application first creates a CK_AnimatedBitmap, and then many CK_Animation objects can be created that reference the animated bitmap.
Parameters
- anim
- The animated bitmap that contains the image data for each frame in the animation.
- takeOwnership
- If TRUE, the CK_Animation owns the animated bitmap. This causes the animated bitmap to be deleted when the CK_Animation is deleted.
Returns the index of the current frame that is visible. The first frame in the animation is at index 0.
Returns the frame rate of the animation (number of frames per second).
Returns the animation as a CK_Subject. This subject can be observed by any CK_Observer. The observer will be notified whenever the animation updates its current frame, or when the animation is deleted.
Advances the current frame by one. Advancing from the last frame will set the current frame to the first frame. The result of advancing the current frame will be visible (if the CK_Animation is visible on the display).
Decrements the current frame index by one. Backing up from the first frame will set the current frame to the last frame. The results of this function call will be visible (if the CK_Animation is visible on the display).
Parameters
- frameIndex
- The current frame will be set to this index.
Parameters
- framesPerSecond
- The speed at which the animation runs.
Starts the animation. If the frame rate is zero, the animation will appear to not be started. In general, animations should only be started if they are visible on the screen. If an animation is started, the Chilkat engine will be advancing the frames of the animation even if the animation is not visible.