LEADTOOLS Raster Imaging C DLL Help > Function References > L_ProcessPlayback |
#include "l_bitmap.h"
L_LTDIS_API L_INT L_ProcessPlayback(hPlayback, puState)
HPLAYBACK hPlayback; |
/* playback handle */ |
L_UINT* puState; |
/* 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 does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.
This function is called in a loop to continually process the playback.
Required DLLs and Libraries
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
Win32, x64, Linux.
See Also
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.
L_INT ProcessPlaybackExample(L_HWND hWnd, pBITMAPHANDLE pBitmap, L_TCHAR* pszFilename, HPALETTE hpalPaint) { L_INT nRet; 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) */ nRet = L_LoadBitmapList(pszFilename, &hList, 0, 0, NULL, NULL); if(nRet != SUCCESS) return nRet; /* Get a copy of the first image's bitmap handle */ nRet = L_GetBitmapListItem(hList, 0, &TmpBitmap, sizeof(BITMAPHANDLE)); if(nRet != SUCCESS) return nRet; /* 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 */ if(pBitmap->Flags.Allocated) L_FreeBitmap(pBitmap); nRet = L_CreateBitmap(pBitmap, sizeof(BITMAPHANDLE), TYPE_CONV, TmpBitmap.Width, TmpBitmap.Height, TmpBitmap.BitsPerPixel, TmpBitmap.Order, NULL, TmpBitmap.ViewPerspective, NULL, 0); if(nRet != SUCCESS) return nRet; /* Update the palette of the target bitmap */ nRet = L_CopyBitmapPalette(pBitmap, &TmpBitmap); if(nRet != SUCCESS) return nRet; /* Create and run the playback */ nRet = L_CreatePlayback(&hPlayback, pBitmap, hList); if(nRet != SUCCESS) return nRet; do { nRet = L_ProcessPlayback(hPlayback, &uState); if(nRet != SUCCESS) return nRet; switch(uState) { case PLAYSTATE_WAITINPUT: nRet = L_CancelPlaybackWait(hPlayback); if(nRet != SUCCESS) return nRet; break; case PLAYSTATE_POSTCLEAR: case PLAYSTATE_POSTRENDER: nRet = L_GetPlaybackUpdateRect(hPlayback, &rcUpdate, TRUE); if(nRet != SUCCESS) return nRet; hdc = GetDC(hWnd); if (hpalPaint) { hPalette = SelectPalette (hdc, hpalPaint, TRUE); RealizePalette(hdc); } nRet = L_PaintDC(hdc, pBitmap, NULL, &rcUpdate, &rcDisplay, &rcDisplay, SRCCOPY); if(nRet != SUCCESS) return nRet; if (hpalPaint) SelectPalette (hdc, hPalette, TRUE); ReleaseDC(hWnd, hdc); break; } } while(uState != PLAYSTATE_END); /* Clean up */ L_DestroyPlayback(hPlayback, NULL); L_DestroyBitmapList(hList); return SUCCESS; }