L_AddBitmaps

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_AddBitmaps(pBitmap, uStructSize, hList, uFlag)

pBITMAPHANDLE pBitmap;

/* pointer to a bitmap handle */

L_UINT uStructSize;

/* size of the BITMAPHANDLE structure */

HBITMAPLIST hList;

/* handle to the list of bitmaps */

L_UINT uFlag;

/* operation flag */

Adds or averages the bitmaps in a list.

Parameter

Description

pBitmap

Pointer to the bitmap handle that references the resulting bitmap on which the effect is applied.

uStructSize

Size in bytes, of the structure pointed to by pBitmap, for versioning. Use sizeof(BITMAPHANDLE).

hList

Handle to the list of bitmaps.

uFlag

Flag that indicates the operation to perform. Possible values are:

 

Value

Meaning

 

BC_AVG

[0x0001] Average the bitmaps in the specified list.

 

BC_ADD

[0x0002] Add the bitmaps in the specified list.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This operation can be used to add several images of the same view to improve the lightness or brightness of the image. It can also eliminate the random noise contained in these images by doing an average of all bitmaps.

This function performs operations between data byte-by-byte. An image can be any color resolution. pBitmap is assumed to be unallocated. If pBitmap contains a bitmap, you should free it prior to calling this function. L_AddBitmaps will allocate and store the resulting bitmap in pBitmap. The image resulting from this operation is internally copied from the first image in the list, before performing the adding operation. The operations are performed based on the smallest width and height of the input images.

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.

To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.

Required DLLs and Libraries

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.

Platforms

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

See Also

Functions:

L_UnderlayBitmap, L_CombineBitmap, L_BricksTextureBitmap, L_CanvasBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_VignetteBitmap, L_AdjustBitmapTint, L_GammaCorrectBitmapExt, L_HighPassFilterBitmap, L_UnsharpMaskBitmap

Topics:

Raster Image Functions: Combining Images

 

Raster Image Functions: Modifying Intensity Values

 

Processing an Image

 

Changing Brightness and Contrast

 

Raster Image Functions: Changing Brightness and Contrast

 

Removing Noise

Example

/* This example creates a bitmap list from one loaded bitmap, rotating each copy by 72 degrees than others, then average them */

HBITMAPLIST hList;  /* Bitmap list */
BITMAPHANDLE LeadBitmap; /* Bitmap handle to hold the loaded image. */
BITMAPHANDLE TmpBitmap; /* Temporary bitmap for manipulating the list */   
BITMAPHANDLE ResultBitmap; /* Bitmap resulting from the operation */   
L_INT i;      /* Loop counter */

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

/* Create and populate the bitmap list */
L_CreateBitmapList
(&hList); 
for (i = 0; i < 4; i++)
   {
      L_CopyBitmap(&TmpBitmap, &LeadBitmap, sizeof(BITMAPHANDLE));
      L_RotateBitmap(&TmpBitmap, i*720, ROTATE_RESAMPLE, RGB(255, 0, 0));
      L_InsertBitmapListItem(hList, (L_UINT)-1, &TmpBitmap);
   }

   /*take the average between all rotated bitmaps and store it in ResultBitmap */ 
   L_AddBitmaps(&ResultBitmap, sizeof(BITMAPHANDLE), hList, BC_AVG);
   L_DestroyBitmapList(hList);