L_ProcessPlayback
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_ProcessPlayback(hPlayback, puState)
HPLAYBACK hPlayback; |
/* playback handle */ |
/* address of the variable to be updated */ |
Processes the next state during an animation playback.
Parameter |
Description |
hPlayback |
Handle that references the animation playback. |
puState |
Address of the variable to be updated with a constant that describes the new state of the animation playback engine. For possible values, refer to Animation Playback States. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
This function is called in a loop to continually process the playback.
Required DLLs and Libraries
LTDIS For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.
See Also
Example
For complete sample code, refer to the CHILD.C module of the DEMO example.
For an example, refer to L_AppendPlayback.
/* This example loads a bitmap list from an animated GIF or AVI file.
It then plays the animation, using the current bitmap as the target. */
HPALETTE hpalPaint; /* Paint palette handle. */
BITMAPHANDLE LeadBitmap; /* Bitmap handle for the loaded image. */
void TestAnimate(L_TCHAR L_FAR * pszFilename, HWND hWnd)
{
HBITMAPLIST hList; /* Bitmap list */
BITMAPHANDLE TmpBitmap; /* Temporary bitmap for building the list */
HPLAYBACK hPlayback; /* Animation playback */
L_UINT uState; /* Next state in the playback */
RECT rcUpdate; /* Source clipping rectangle used in playback */
RECT rcDisplay; /* Display rectangle used in playback */
HDC hdc; /* Device context of the current window */
HPALETTE hPalette = NULL; /* Temporary copy of the current system palette */
/* Create the bitmap list from the input file (GIF or AVI) */
L_LoadBitmapList(pszFilename, &hList, 0, 0, NULL, NULL);
/* Get a copy of the first image's bitmap handle */
L_GetBitmapListItem(hList, 0, &TmpBitmap, sizeof(BITMAPHANDLE));
/* Create the palette that is used for playback */
hdc = GetDC (hWnd);
hpalPaint = L_CreatePaintPalette(hdc, &TmpBitmap);
ReleaseDC (hWnd, hdc);
/* Use the client area as the display rectangle,
assuming that the window is properly sized */
GetClientRect(hWnd,&rcDisplay);
/* Create the target bitmap that is used for playback */
L_CreateBitmap(&LeadBitmap, sizeof(BITMAPHANDLE), TYPE_CONV,
TmpBitmap.Width,
TmpBitmap.Height,
TmpBitmap.BitsPerPixel,
TmpBitmap.Order,
NULL,
TmpBitmap.ViewPerspective, NULL, 0);
/* Update the palette of the target bitmap */
L_CopyBitmapPalette(&LeadBitmap, &TmpBitmap);
/* Create and run the playback */
L_CreatePlayback(&hPlayback, &LeadBitmap, hList);
do
{
L_ProcessPlayback(hPlayback, &uState);
switch(uState)
{
case PLAYSTATE_WAITINPUT:
L_CancelPlaybackWait(hPlayback);
break;
case PLAYSTATE_POSTCLEAR:
case PLAYSTATE_POSTRENDER:
L_GetPlaybackUpdateRect(hPlayback, &rcUpdate, TRUE);
hdc = GetDC(hWnd);
if (hpalPaint)
{
hPalette = SelectPalette (hdc, hpalPaint, TRUE);
RealizePalette(hdc);
}
L_PaintDC(hdc, &LeadBitmap, NULL, &rcUpdate, &rcDisplay, &rcDisplay, SRCCOPY);
if (hpalPaint)
SelectPalette (hdc, hPalette, TRUE);
ReleaseDC(hWnd, hdc);
break;
}
} while(uState != PLAYSTATE_END);
/* Clean up */
L_DestroyPlayback(hPlayback, NULL);
L_DestroyBitmapList(hList);
}