L_ClearNegativePixels

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_ClearNegativePixels(pBitmap)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

Sets all pixels with negative color values to 0.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the bitmap that holds the image data.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

If ELO_SIGNED flag has been set using LOADFILEOPTION, when a file is loaded, the bitmap may contain negative pixel values and LEADTOOLS will paint/process the image incorrectly. In order to use this bitmap correctly, you must call L_ClearNegativePixels. If the ELO_SIGNED flag has not been set, all negative pixels are cleared internally, during the load process. Since some TIFF files are saved with negative values for pixel colors, you should call L_ClearNegativePixels if, after loading a bitmap, pBitmap->Flags.Signed is TRUE.

L_ClearNegativePixels does nothing if Flags.Signed is not set.

PROGRAMMING TIP: call L_ClearNegativePixels right after L_LoadBitmap.

Required DLLs and Libraries

LTKRN

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

Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.

See Also

Functions:

L_LoadBitmap, L_ClearBitmap

Topics

Raster Image Functions: Getting and Setting Pixel Values

Example

This example sets the ELO_SIGNED flag in LOADFILEOPTION, loads a tif file and clears the negative pixels.

BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image. */
LOADFILEOPTION LoadFileOption;

/* enable negative pixels to be loaded from TIFF files */
L_GetDefaultLoadFileOption
(&LoadFileOption, sizeof(LOADFILEOPTION));
LoadFileOption.Flags |= ELO_SIGNED;

/* Load the bitmap, keeping the bits per pixel of the file */
L_LoadBitmap
 (TEXT("IMAGE1.TIF"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, &LoadFileOption, NULL);

/* clear negative pixels if signed */
if(LeadBitmap.Flags.Signed)
   L_ClearNegativePixels(&LeadBitmap);