LBitmap::LineProfile

Summary

Allocates three arrays and updates them with the R, G and B profile for each pixel in the specified line.

Syntax

#include "ltwrappr.h"

virtual L_INT LBitmap::LineProfile(FirstPoint, SecondPoint, ppRed, ppGreen, ppBlue, uFlags = 0)

Parameters

POINT FirstPoint

POINT structure that contains the starting point for the line.

POINT SecondPoint

POINT structure that contains the end point for the line. Information for this point is included in the arrays.

L_INT ** ppRed

Pointer to a pointer to be updated with an array that contains the red values for the line specified by FirstPoint and SecondPoint. A memory buffer for this array is allocated by the function. When the array is no longer needed, it should be freed by the user by calling the GlobalFreePtr macro.

L_INT ** ppGreen

Pointer to a pointer to be updated with an array that contains the green values for the line specified by FirstPoint and SecondPoint. A memory buffer for this array is allocated by the function. When the array is no longer needed, it should be freed by the user by calling the GlobalFreePtr macro.

L_INT ** ppBlue

Pointer to a pointer to be updated with an array that contains the blue values for the line specified by FirstPoint and SecondPoint. A memory buffer for this array is allocated by the function. When the array is no longer needed, it should be freed by the user by calling the GlobalFreePtr macro.

L_UINT32 uFlags

Reserved for future use. Must be 0.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function allocates memory buffers for the three arrays using the GlobalAllocPtr macro. When the buffers are no longer needed, they should be freed by calling the GlobalFreePtr macro. If the GlobalFreePtr macro is not supported by the compiler, the buffers can be freed using the following code:

void MyGlobalFreePtr(void *ptr) 
{ 
   HGLOBAL hGlobal = (HGLOBAL) GlobalHandle(ptr); 
   GlobalUnlock(hGlobal); 
   GlobalFree(hGlobal); 
} 

The ranges of returned values will be:

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LBitmap__LineProfileExample(LBitmap & Bitmap, L_TCHAR * szFileName) 
{ 
   L_INT nRet; 
   L_INT * pRed = NULL; 
   L_INT * pGreen = NULL; 
   L_INT * pBlue = NULL; 
   POINT StartPoint, EndPoint; 
 
   nRet =Bitmap.Load(szFileName); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   StartPoint.x = 0; 
   StartPoint.y = 0; 
   EndPoint.x = Bitmap.GetWidth(); 
   EndPoint.y = Bitmap.GetHeight (); 
 
   nRet =Bitmap.LineProfile(StartPoint, EndPoint, &pRed, &pGreen, &pBlue); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   /* ... Do something with the colors in the arrays */ 
 
   GlobalFreePtr(pRed); 
   GlobalFreePtr(pGreen); 
   GlobalFreePtr(pBlue); 
 
   return SUCCESS; 
} 
Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.