L_DispContainerGetCellBitmapList

#include "ltivw.h"

L_LTIVW_API L_INT L_DispContainerGetCellBitmapList(hCellWnd, phBitmapList, uFlags)

HWND hCellWnd;

/* handle to the cell window */

pHBITMAPLIST * phBitmapList;

/* pointer to a variable to be updated */

L_UINT uFlags;

/* reserved for future use */

Gets the bitmap list attached to the specified cell.

Parameter

Description

hCellWnd

A handle to the window that represents the cell on which the function's effect will be applied.

phBitmapList

Pointer to the variable to be updated with the cell's bitmap list.

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

If the cell at the specified index has no image, phBitmapList will be NULL.

Call L_DispContainerSetCellBitmapList to set the bitmap list for a cell.

Required DLLs and Libraries

LTIVW

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:

L_DispContainerCreate, L_DispContainerRemoveCell, L_DispContainerInsertCell, L_DispContainerGetCellCount, L_DispContainerGetCellWindowHandle, L_DispContainerSetCellBitmapList, L_DispContainerSetCellTag, L_DispContainerSetCellProperties, L_DispContainerGetCellProperties, L_DispContainerRepositionCell, L_DispContainerGetCellPosition, L_DispContainerGetCellBounds, L_DispContainerFreezeCell, L_DispContainerSelectCell, L_DispContainerIsCellSelected, L_DispContainerIsCellFrozen

Topics:

Image Viewer Cells

 

Image Viewer Functions: Image Viewer Cells

Example

This function removes the specified cell without removing its image list.

#if defined LEADTOOLS_V17_OR_LATER
 L_INT DispContainerGetCellBitmapListExample(HDISPCONTAINER hCon,
                                                            HBITMAPLIST  * hBitmapList,
                                                            L_INT          nCellIndex)
{
   L_INT nRet;
   L_INT nCount = L_DispContainerGetCellCount (hCon, 0); 

   // Check the validity of the cell index
   if ((nCellIndex < 0) || (nCellIndex >= nCount)) 
      return 0; 

   HWND hCellWnd = L_DispContainerGetCellWindowHandle(hCon, nCellIndex, 0);

   // retrieve the bitmap list. 
   nRet = L_DispContainerGetCellBitmapList(hCellWnd, hBitmapList, 0); 
   if(nRet != SUCCESS)
      return nRet;

   // remove the cell
   nRet = L_DispContainerRemoveCell (hCellWnd, FALSE, 0); 
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}

L_INT DispContainerImageProcessingExample(HDISPCONTAINER hCon,
                                                         L_INT          nCellIndex)
{
   BITMAPHANDLE Bitmap;
   HBITMAPLIST hBitmapList;

   if (L_DispContainerGetCellCount(hCon, 0) == 0)
   {
      MessageBox(NULL, TEXT("you must at least have one cell added to the viewer"), TEXT("No Cell attached"), MB_OK);
      return FAILURE;
   }

   HWND hCellWnd = L_DispContainerGetCellWindowHandle(hCon, 0, 0);

   // Get the bitmap list of the first cell.
   L_INT nRet = L_DispContainerGetCellBitmapList(hCellWnd, &hBitmapList, 0);
   if (nRet != SUCCESS)
      return nRet;

   //Deattach the bitmap list from the contianer inorder to perform some image processing on it.
   nRet = L_DispContainerSetCellBitmapList(hCellWnd, NULL, 0, 0);
   if (nRet != SUCCESS)
      return nRet;

   // get the first bitmap in the bitmap list .
   nRet = L_GetBitmapListItem(hBitmapList, nCellIndex, &Bitmap, sizeof(BITMAPHANDLE));
   if (nRet != SUCCESS)
      return nRet;

   // fill the bitmap will the desiared color.
   nRet = L_MultiScaleEnhancementBitmap(&Bitmap, 2000, 4, MSE_DEFAULT , 0, 0, MSE_GAUSSIAN | MSE_EDGEENH);
   if(nRet !=SUCCESS)
      return nRet;

   // set the bitmap list again.
   nRet = L_SetBitmapListItem(hBitmapList, nCellIndex, &Bitmap);
   nRet = L_DispContainerSetCellBitmapList(hCellWnd, hBitmapList, 0, 0);

   return nRet;
}


#else



 L_INT DispContainerGetCellBitmapListExample(HDISPCONTAINER hCon,
                                                            HBITMAPLIST  * hBitmapList,
                                                            L_INT          nCellIndex)
{
   L_INT nRet;
   L_INT nCount = L_DispContainerGetCellCount (hCon, 0); 

   // Check the validity of the cell index
   if ((nCellIndex < 0) || (nCellIndex >= nCount)) 
      return 0; 

   // retrieve the bitmap list. 
   nRet = L_DispContainerGetCellBitmapList(hCon, nCellIndex, hBitmapList, 0); 
   if(nRet != SUCCESS)
      return nRet;

   // remove the cell
   nRet = L_DispContainerRemoveCell (hCon, nCellIndex, FALSE, 0); 
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}

L_INT DispContainerImageProcessingExample(HDISPCONTAINER hCon,
                                                         L_INT          nCellIndex)
{
   BITMAPHANDLE Bitmap;
   HBITMAPLIST hBitmapList;

   // Get the bitmap list of the first cell.
   L_INT nRet = L_DispContainerGetCellBitmapList(hCon, 0, &hBitmapList, 0);
   if (nRet != SUCCESS)
      return nRet;

   //Deattach the bitmap list from the contianer inorder to perform some image processing on it.
   nRet = L_DispContainerSetCellBitmapList(hCon, 0, NULL, 0, 0);
   if (nRet != SUCCESS)
      return nRet;

   // get the first bitmap in the bitmap list .
   nRet = L_GetBitmapListItem(hBitmapList, nCellIndex, &Bitmap, sizeof(BITMAPHANDLE));
   if (nRet != SUCCESS)
      return nRet;

   // fill the bitmap will the desiared color.
   nRet = L_MultiScaleEnhancementBitmap(&Bitmap, 2000, 4, MSE_DEFAULT , 0, 0, MSE_GAUSSIAN | MSE_EDGEENH);
   if(nRet !=SUCCESS)
      return nRet;

   // set the bitmap list again.
   nRet = L_SetBitmapListItem(hBitmapList, nCellIndex, &Bitmap);
   nRet = L_DispContainerSetCellBitmapList(hCon, 0, hBitmapList, 0, 0);

   return nRet;
}


#endif