L_IsPtInBitmapRgn

#include "l_bitmap.h"

L_LTDIS_API L_BOOL L_IsPtInBitmapRgn(pBitmap, nRow, nCol)

Determines whether the specified pixel is in the bitmap region.

Parameters

pBITMAPHANDLE pBitmap

Pointer to the bitmap handle referencing the bitmap that has the region.

L_INT nRow

The row number of the pixel.

L_INT nCol

The column number of the pixel.

Returns

Value Meaning
TRUE The specified pixel is in the region.
FALSE The specified pixel is outside the region.

Comments

This function uses bitmap coordinates to specify the pixel. Therefore, you must account for the view perspective of the bitmap. For more information, refer to Accounting for View Perspective.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

L_INT IsPtInBitmapRgnExample(pBITMAPHANDLE   LeadBitmap, 
                                             L_INT          BitmapX, 
                                             L_INT          BitmapY, 
                                             L_INT          DisplayWidth, 
                                             L_INT          DisplayHeight, 
                                             L_INT          DisplayLeft, 
                                             L_INT          DisplayTop) 
{ 
   L_INT nRet; 
   /* Translate mouse positions to bitmap coordinates */ 
   BitmapX *= BITMAPWIDTH(LeadBitmap) / (DisplayWidth - DisplayLeft); 
   BitmapY *= BITMAPHEIGHT(LeadBitmap) / (DisplayHeight - DisplayTop); 
 
   /* Adjust for view perspective */ 
   nRet = L_PointToBitmap ( LeadBitmap, TOP_LEFT, &BitmapX, &BitmapY ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* Display a message if the point is in the region */ 
   if (L_IsPtInBitmapRgn(LeadBitmap, BitmapY, BitmapX)) 
      MessageBox (NULL, TEXT("Point is in region"), TEXT("Notice"), MB_OK); 
   return SUCCESS; 
} 
Help Version 20.0.2019.9.22
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help