LImageViewer::GetBitmapPixel

#include "ltwrappr.h"

L_INT LImageViewer::GetBitmapPixel(nCellIndex, nSubCellIndex, pSrcPoint, pBitmapPoint, uFlags)

L_INT nCellIndex;

/* index of the cell */

L_INT nSubCellIndex;

/* index into the image list attached to the cell */

LPPOINT pSrcPoint;

/* pointer to a POINT structure */

LPPOINT pBitmapPoint;

/* address of the POINT structure to be updated */

L_UINT uFlags;

/* reserved for future */

Gets the bitmap pixel associated with the specified POINT structure.

Parameter

Description

nCellIndex

A zero-based index of the cell for which to get the bitmap coordinates. Pass -2 to get the bitmap coordinates of the specified sub-cell in the first selected cells.

nSubCellIndex

A zero-based index into the image list attached to the cell specified in nCellIndex. This sub-cell contains the image that contains the bitmap. Pass -2 to refer to the selected sub-cell.

pSrcPoint

Pointer to the POINT structure that specifies the point to get the corresponding bitmap coordinates. Coordinates are relative to the associated cell area.

pBitmapPoint

Pointer to the POINT structure to be updated with the bitmap coordinates that correspond to the specified point pSrcPoint.

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function will return the value of the pixel that correspond the the given pSrcPoint. If the pSrcPoint value falls outside the range of valid coordinates for the bitmap, the returned Point will be -1, -1.

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:

LImageViewer::Create, LImageViewer::RemoveCell, LImageViewer::InsertCell, LImageViewer::GetCellCount, LImageViewer::GetWindowHandle, LImageViewer::SetCellBitmapList, LImageViewer::SetCellTag, LImageViewer::GetCellProperties, LImageViewer::GetCellPosition, LImageViewer::RepositionCell, LImageViewer::GetCellBitmapList, LImageViewer::GetCellBounds, LImageViewer::FreezeCell, LImageViewer::SelectCell, LImageViewer::IsCellSelected, LImageViewer::IsCellFrozen, Class Members

Topics:

Image Viewer Cells

 

Window Control/Image Viewer Functions: Image Viewer Cells

Example

this example draw dots on the image when clicking on it using the left mouse button.

class LImageViewerChild2 :public LImageViewer
{
   virtual L_INT MouseCallBack(L_UINT                 uMessage,
                                 pDISPCONTAINERCELLINFO pCellInfo);
} ; 
L_INT LImageViewerChild2::MouseCallBack(L_UINT                 uMessage,
                                       pDISPCONTAINERCELLINFO pCellInfo)
{
   UNREFERENCED_PARAMETER(pCellInfo);
   POINT ptBitmapPoint;
   BITMAPHANDLE Bitmap;
   LBitmap      BitmapHandle;
   switch(uMessage)
   {
   case WM_LBUTTONDOWN:
      {
         POINT ptPoint = {pCellInfo->nX, pCellInfo->nY};
         GetBitmapPixel( pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, &ptPoint, &ptBitmapPoint, 0);
         GetBitmapHandle( pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, &Bitmap, 0);
         BitmapHandle.SetHandle(&Bitmap);
         BitmapHandle.PutPixelColor(ptBitmapPoint.y, ptBitmapPoint.x, RGB(255, 255, 255));
         pBITMAPHANDLE pBitmap = BitmapHandle.GetHandle();
         SetBitmapHandle( pCellInfo->nCellIndex, pCellInfo->nSubCellIndex, pBitmap, TRUE, 0);
         BitmapHandle.SetHandle(NULL, FALSE);
      }
      break;
   }
   return SUCCESS;
}
L_INT LImageViewer_GetBitmapPixel(LImageViewer& ImageViewer)
{
   ImageViewer.EnableMouseCallBack( TRUE);
   return SUCCESS;
}