LAnimationWindow::GetAt
#include "ltwrappr.h"
L_INT LAnimationWindow::GetAt(nIndex, pBitmap, bReflectIndex = FALSE)
L_UINT nIndex; |
/* position of the bitmap in the list */ |
LBitmapBase * pBitmap; |
/* pointer to the bitmap handle */ |
L_BOOL bReflectIndex; |
/* flag that indicates whether to set the current index to the passed index */ |
Gets an LBitmapBase object that references a bitmap in the class object's bitmap list.
Parameter |
Description |
|
nIndex |
Position of the bitmap in the list. Use zero-based indexing. For example, if there are 10 bitmaps in a list, the index of the last one is 9. |
|
pBitmap |
Pointer to the bitmap handle that will reference the bitmap in the list. |
|
bReflectIndex |
Flag that indicates whether to set the current index to the passed index. Possible values are: |
|
|
Value |
Meaning |
|
TRUE |
Set the class objects current index to the passed index. |
|
FALSE |
Do not set the class objects current index to the passed index. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
The bitmap handle that this method gets is a copy of the bitmap handle stored internally in the list. If you modify the bitmap using this handle, you can update the internal bitmap handle to reflect the changes by using the LAnimationWindow::SetAt method.
You cannot use this method to update a bitmap list while it is being used in an animation playback.
Required DLLs and Libraries
LTKRN |
See Also
Functions: |
|
Topics: |
|
|
Example
/*<documentation/>*/ class MyAnimationWindow : public LAnimationWindow { public : L_INT GetFrame(L_UINT nIndex, LBitmapBase * pBitmap, L_BOOL bReflectIndex = FALSE) { return GetAt(nIndex, pBitmap, bReflectIndex); } L_INT SetFrame(L_UINT nIndex, LBitmapBase * pBitmap, L_BOOL bReflectIndex = FALSE) { return SetAt(nIndex, pBitmap, bReflectIndex); } L_INT InsertFrame(LBitmapBase * pBitmap, L_UINT nIndex) { return LAnimationWindow::InsertFrame(pBitmap, nIndex); } L_INT RemoveFrame(L_UINT nIndex, LBitmapBase * pBitmap) { return LAnimationWindow::RemoveFrame(nIndex,pBitmap); } }; L_INT GetAtExample(HWND hWndParent) { L_INT nRet; LBase::LoadLibraries(LT_ALL_LEADLIB); //make sure all libraries are loaded MyAnimationWindow MyAnimation; LBitmapBase bitmap; LBitmapBase newBitmap; LBitmapBase removedBitmap; WRPUNLOCKSUPPORT(); MyAnimation.SetFileName(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\eye.gif")); nRet = MyAnimation.Load(); if (nRet!=SUCCESS) return nRet; //Flip the first frame MyAnimation.GetFrame(0, &bitmap, FALSE); bitmap.Flip(); MyAnimation.SetFrame(0, &bitmap, FALSE); //Remove the last frame, and replace it with new bitmap nRet = MyAnimation.RemoveFrame(MyAnimation.GetCount(), NULL); if (nRet!=SUCCESS) return nRet; nRet = newBitmap.Load(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\image4.gif")); if (nRet!=SUCCESS) return nRet; nRet = MyAnimation.InsertFrame(&newBitmap, (L_UINT)-1); // Replace the second item with new bitmap; if (nRet==SUCCESS) { MyAnimation.CreateWnd(hWndParent,0, WS_VISIBLE|WS_CHILD|WS_BORDER,0,0,300,300); for (L_UINT i=0; i<MyAnimation.GetCount(); i++) { nRet = MyAnimation.MoveToFrame(i); if(nRet != SUCCESS) return nRet; if (MyAnimation.IsFirstFrame()) { MessageBox(hWndParent, TEXT("First frame..."),TEXT("Example"), MB_OK | MB_ICONINFORMATION); } else if (MyAnimation.IsLastFrame()) { MessageBox(hWndParent, TEXT("Last frame..."),TEXT("Example"), MB_OK | MB_ICONINFORMATION); } } } else return nRet; return SUCCESS; }