LAnimationWindow::EnableTransparency

#include "ltwrappr.h"

L_INT LAnimationWindow::EnableTransparency(bEnable=TRUE, clrTransparent=RGB(0,0,0), nIndex=ANIM_ALL_ITEMS)

L_BOOL bEnable;

/* flag that indicates whether to enable transparency */

COLORREF clrTransparent;

/* transparent color */

L_UINT nIndex;

/* position of the bitmap list item */

Sets the transparency parameters to be used with playback for the bitmap item at position nIndex inside the bitmap list.

Parameter

Description

bEnable

Flag that indicates whether to enable or disable transparency. Possible values are:

Value

Meaning

TRUE

Enable transparency.

FALSE

Disable transparency.

clrTransparent

COLORREF that represents the transparent color to use for animation playback.

nIndex

Position of the bitmap list item. Possible values are:

Value

Meaning

ANIM_ALL_ITEMS

[-1] Set the delay for all items in the bitmap list

>=0

Set the delay only for the specified item

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Passing nIndex = ANIM_ALL_ITEMS will cause all the bitmaps in the list to be set.

Required DLLs and Libraries

LTDIS
LTDLG
LTEFX
LTFIL
LTIMG
LTISI
LTSCR
LTTWN

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:

LAnimationWindow::LAnimationWindow, LAnimationWindow::IsTransparencyEnabled, LAnimationWindow::Load, LAnimationWindow::PlayAnimation, Class Members

Topics:

Implementing Animation, Implementing Transparency

 

Using Color Values in LEADTOOLS

Example

The following example will change the transparency information

for odd numbered items in the animation list using EnableTransparency,

then reads the new information using IsTransparencyEnabled.

L_INT LAnimationWindow_EnableTransparencyExample(HWND hWndParent)
{
   L_INT nRet;
   LBase::LoadLibraries(LT_ALL_LEADLIB); //make sure all libraries are loaded
   LAnimationWindow MyAnimation;
   WRPUNLOCKSUPPORT();
   MyAnimation.SetFileName(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\eye.gif"));
   nRet = MyAnimation.Load();
   if (nRet==SUCCESS)
   {
      L_BOOL   bEnabled;
      COLORREF crTranparent;
      L_UINT i;
      MyAnimation.CreateWnd(hWndParent,0, WS_VISIBLE|WS_CHILD|WS_BORDER,0,0,300,300);
      //change the transparency...
      for (i=0; i<MyAnimation.GetCount(); i++)
      {
           if (i%2)
           {
               nRet = MyAnimation.EnableTransparency(TRUE, RGB(i*35 % 256, i*50 % 256, i*75 % 256), i);
               if(nRet != SUCCESS)
                  return nRet;
           }
      }
      for (i=0; i<MyAnimation.GetCount(); i++)
      {
         L_TCHAR szStr[255];
         //get current transparenct info for each bitmap...
         nRet =  MyAnimation.IsTransparencyEnabled(&bEnabled, &crTranparent, i);
         if(nRet != SUCCESS)
            return nRet;
         wsprintf(szStr,TEXT("Bitmap[%d] Transparency Info: Enabled= %s Color = &H%08X"),i, (bEnabled?TEXT("YES"):TEXT("NO")), crTranparent);
         MessageBox(hWndParent, szStr,TEXT("Example"), MB_OK | MB_ICONINFORMATION);
      }
   }
   else
      return nRet;
   return SUCCESS;
}