Gets the bitmap pixel associated with the specified POINT structure.
#include "ltwrappr.h"
L_INT LImageViewerCell::GetBitmapPixel(nSubCellIndex, pSrcPoint, pBitmapPoint, uFlags)
A zero-based index into the image list attached to the cell. This sub-cell contains the image that contains the bitmap. Pass -2 to refer to the selected sub-cell.
Pointer to the POINT structure that specifies the point to get the corresponding bitmap coordinates. Coordinates are relative to the associated cell area.
Pointer to the POINT structure to be updated with the bitmap coordinates that correspond to the specified point pSrcPoint.
Reserved for future use. Pass 0.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This function will return the value of the pixel that correspond the given pSrcPoint. If the pSrcPoint value falls outside the range of valid coordinates for the bitmap, the returned Point will be -1, -1.
this example draw dots on the image when clicking on it using the left mouse button.
class LImageViewerChild2 :public LImageViewerCell
{
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->nSubCellIndex, &ptPoint, &ptBitmapPoint, 0);
GetBitmapHandle( pCellInfo->nSubCellIndex, &Bitmap, 0);
BitmapHandle.SetHandle(&Bitmap);
BitmapHandle.PutPixelColor(ptBitmapPoint.y, ptBitmapPoint.x, RGB(255, 255, 255));
pBITMAPHANDLE pBitmap = BitmapHandle.GetHandle();
SetBitmapHandle( pCellInfo->nSubCellIndex, pBitmap, TRUE, 0);
BitmapHandle.SetHandle(NULL, FALSE);
}
break;
}
return SUCCESS;
}
L_INT LImageViewer_GetBitmapPixelExample(LImageViewerCell& ImageViewerCell)
{
ImageViewerCell.EnableMouseCallBack( TRUE);
return SUCCESS;
}