L_IsPtInBitmapRgn

#include "l_bitmap.h"

L_LTDIS_API L_BOOL L_IsPtInBitmapRgn(pBitmap, nRow, nCol)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

L_INT nRow;

/* row number of the pixel */

L_INT nCol;

/* column number of the pixel */

Determines whether the specified pixel is in the bitmap region.

Parameter

Description

pBitmap

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

nRow

The row number of the pixel.

nCol

The column number of the pixel.

Returns

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

LTDIS

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

L_FrameBitmapRgn, L_BitmapHasRgn, L_FreeBitmapRgn, L_GetBitmapRgnArea

Topics:

Raster Image Functions: Creating and Using a Region

 

Raster Image Functions: Region Processing

 

Defining and Using a Bitmap Region

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;
}