LImageViewerCell::StartAnimation

#include "ltwrappr.h"

L_INT LImageViewerCell::StartAnimation(nStartFrame, nFrameCount, bAnimateAllSubCells, uFlags)

L_INT nStartFrame;

/* animation start index */

L_INT nFrameCount;

/* animation total frames */

L_BOOL bAnimateAllSubCells;

/* flag */

L_UINT uFlags;

/* reserved for future use */

Starts an animation in the specific cell(s).

Parameter

Description

nStartFrame

Value that represents the initial frame to start animation from.

nFrameCount

Value that represents the number of frames that the animation will go through.

bAnimateAllSubCells

Flag that indicates whether to animate all sub-cells (If the cell layout shows more than one frame at a time). Possible values are:

 

Value

Meaning

 

TRUE

Animate all sub-cells.

 

FALSE

Do not animate all sub-cells

uFlags

Flags that determine whether to apply the feature on the one cell only, or more than one cell. This value can only be used when the cell is attached to the LImageViewer through the function LImageViewer::InsertCell. Possible values are:

 

Value

Meaning

 

CELL_APPLYTOTHIS

[0x00000000] Apply the feature to this cell only.

 

CELL_APPLYTOALL

[0x10000000] Apply the feature to all the cells in the Image Viewer.

 

CELL_APPLYTOSELECTED

[0x20000000] Apply the feature to the selected cells in the Image Viewer.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The cell(s) must contain multiple frames.

To stop the animation, call the LImageViewerCell::StopAnimation function.

To check whether the cell is in an animation phase, call the LImageViewerCell::IsCellAnimated function.

The user can change or retrieve the animation properties even if the animation is started.

To retrieve the animation properties of a specific cell, call the LImageViewerCell::GetAnimationProperties function.

To change the animation properties of a specific cell, call the LImageViewerCell::SetAnimationProperties function.

The Image viewer must be created before calling this function or an error will be returned.

Required DLLs and Libraries

LTIVW

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LImageViewer::Create, LImageViewer::Destroy, LImageViewerCell::StopAnimation, LImageViewerCell::GetAnimationProperties, LImageViewerCell::SetAnimationProperties, LImageViewerCell::IsCellAnimated.

Topics:

Image Viewer Functions: Implementing Animation

 

Implementing Animation

Example

This function starts an animation for the pass nCellIndex, we assumed that the cell with index (nCellIndex) contains multiple frames.

#if defined LTV17_CONFIG
L_INT LImageViewer_StartAnimation(LImageViewerCell& ImageViewerCell) 
{
   DISPANIMATIONPROPS DispAnimationProps; 
   HBITMAPLIST        hBitmapList = NULL; 
   L_INT              nCount; 
   ImageViewerCell.GetAnimationProperties(&DispAnimationProps, 0); 
   DispAnimationProps.uInterval = 100; 
   DispAnimationProps.uFlags = CONTAINER_ANIMATION_DIRECTION_FORWARD; 
   ImageViewerCell.SetAnimationProperties(&DispAnimationProps, 0); 
   ImageViewerCell.GetCellBitmapList(&hBitmapList, 0); 
   LBitmapList BitmapList;
   BitmapList.SetHandle(hBitmapList);
   nCount = BitmapList.GetItemsCount();
   if (!ImageViewerCell.IsCellAnimated(0)) 
      ImageViewerCell.StartAnimation(0, nCount, TRUE, 0); 
   return SUCCESS; 
}
#else
L_INT LImageViewer_StartAnimation(LImageViewer& ImageViewer) 
{
   DISPANIMATIONPROPS DispAnimationProps; 
   HBITMAPLIST        hBitmapList = NULL; 
   L_INT              nCount; 
   L_INT nCellIndex = 0;
   if (nCellIndex < 0 || nCellIndex > ImageViewer.GetCellCount(0)) 
      return ERROR_INV_PARAMETER; 
   ImageViewer.GetAnimationProperties(nCellIndex, &DispAnimationProps, 0); 
   DispAnimationProps.uInterval = 100; 
   DispAnimationProps.uFlags = CONTAINER_ANIMATION_DIRECTION_FORWARD; 
   ImageViewer.SetAnimationProperties(nCellIndex, &DispAnimationProps, 0); 
   ImageViewer.GetCellBitmapList(nCellIndex, &hBitmapList, 0); 
   LBitmapList BitmapList;
   BitmapList.SetHandle(hBitmapList);
   nCount = BitmapList.GetItemsCount();
   if (!ImageViewer.IsCellAnimated(nCellIndex, 0)) 
      ImageViewer.StartAnimation(nCellIndex, 0, nCount, TRUE, 0); 
   return SUCCESS; 
}
#endif // LTV17_CONFIG