LAnimationWindow::EnableTransparency

#include "ltwrappr.h"

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

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

Parameters

L_BOOL bEnable

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

Value Meaning
TRUE Enable transparency.
FALSE Disable transparency.

COLORREF clrTransparent

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

L_UINT 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

Value Meaning
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

Platforms

Win32, x64.

See Also

Functions

Topics

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; 
 
   MyAnimation.SetFileName(MAKE_IMAGE_PATH(TEXT("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; 
} 

Help Version 20.0.2020.4.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help