LBitmap::LineProfile

#include "ltwrappr.h"

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

POINT FirstPoin;

/* starting point of the line */

POINT SecondPoint;

/* end point of the line */

L_UINT ** ppRed;

/* pointer to a pointer */

L_UINT ** ppGreen;

/* pointer to a pointer */

L_UINT ** ppBlue;

/* pointer to a pointer */

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

Parameter

Description

FirstPoin

POINT structure that contains the starting point for the line.

SecondPoint

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

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.

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.

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.

Returns

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 range of returned values will be from 0 - 65535 for 64-bit, 48-bit and 16-bit grayscale images and from 0 - 4095 for 12-bit grayscale images. Otherwise, it is from 0 to 255.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Supportfor 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 signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

Required DLLs and Libraries

LTDIS
LTFIL
LTIMG

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

See Also

Functions:

LBitmapBase::Access, LBitmapBase::Release, LBitmapBase::Clear, LBitmapBase::GetRow, LBitmapBase::PutRow, LBitmapBase::GetRowCol, LBitmapBase::PutRowCol, LBitmapBase::PutPixelColor, LBitmapBase::GetPixelColor, Class Members

Topics:

Raster Image Functions: Getting and Setting Pixel Values

 

Removing Noise

Example

L_VOID LineProfileSample(LBitmap & Bitmap, L_TCHAR * szFileName)
{
   L_UINT * pRed = NULL;
   L_UINT * pGreen = NULL;
   L_UINT * pBlue = NULL;
   POINT StartPoint, EndPoint;

   Bitmap.Load(szFileName);

   StartPoint.x = 0;
   StartPoint.y = 0;
   EndPoint.x = Bitmap.GetWidth();
   EndPoint.y = Bitmap.GetHeight ();

   Bitmap.LineProfile(StartPoint, EndPoint, &pRed, &pGreen, &pBlue);

   /* ... Do something with the colors in the arrays */

   GlobalFreePtr(pRed);
   GlobalFreePtr(pGreen);
   GlobalFreePtr(pBlue);
}