L_IsPtInBitmapRgn

Summary

Determines whether the specified pixel is in the bitmap region.

Syntax

#include "l_bitmap.h"

L_LTDIS_API L_BOOL L_IsPtInBitmapRgn(pBitmap, nRow, nCol)

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 DisplayWidth, 
   L_INT DisplayHeight, 
   L_INT DisplayLeft, 
   L_INT DisplayTop) 
{ 
   L_INT nRet; 
   L_INT BitmapX = 0; 
   L_INT BitmapY = 0; 
 
   /* 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)) 
      _tprintf(TEXT("Notice: Point is in region.")); 
 
   return SUCCESS; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.