L_UpdateBitmapOverlayBits

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_UpdateBitmapOverlayBits(pBitmap, nIndex, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to the main bitmap handle */

L_INT nIndex;

/* the overlay index */

L_UINT uFlags;

/* flags that determine which bits to update */

Updates the overlay bitmap pixels with the bits from the corresponding bitplane of the main bitmap. It can also update the main bitmap’s bitplane with the data from the overlay bitmap. This function is available in the Medical toolkits.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the main bitmap.

nIndex

The index of the overlay used in the process. This overlay must have the corresponding bitplane set, otherwise the function will fail and ERROR_OVERLAY_INDEX will be returned. This index is zero-based.

uFlags

Flags that determine whether the main bitmap or the overlay bitmap should be updated. You can ‘or’ SETOVERLAYBITS_FROMOVERLAY and SETOVERLAYBITS_CLEAR. Possible values are:

 

Value

Meaning

 

SETOVERLAYBITS_FROMOVERLAY

[0x0001] Update the main bitmap’s bits for the corresponding bitplane using the data from the overlay bitmap.

 

SETOVERLAYBITS_FROMBITMAP

[0x0002] Update the overlay bitmap with the bits from the corresponding bit plane of the main bitmap. Can be or-ed with SETOVERLAYBITS_CLEAR.

 

SETOVERLAYBITS_CLEAR

[0x0004] Clear the bits from the bitplane associated with the overlay that are not contained in the overlay bitmap (use only in combination with SETOVERLAYBITS_FROMOVERLAY)

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The function will only work for grayscale 8, 12 or 16-bit bitmaps. Support for 12 and 16-bit grayscale bitmaps is only in the Document/Medical toolkits.

If SETOVERLAYBITS_FROMOVERLAY is set in uFlags, the bitplane in the main bitmap will be updated to match the overlay bitmap data. The left and top coordinates for the overlay bitmap are used. If SETOVERLAYBITS_CLEAR is set, the bits from the bitplane associated with the overlay are set to 0 if they are not covered by the overlay. If SETOVERLAYBITS_CLEAR is not set, the bits from the bitplane associated with the overlay that are not covered by the overlay bitmap are left unchanged.

If SETOVERLAYBITS_FROMBITMAP is set, the overlay bitmap will be updated with the bits from the corresponding bitplane. The size of the overlay bitmap is unchanged if it has ever been set. If the overlay bitmap has never been set, the overlay bitmap will be from left, top coordinate to the bottom-right corner of the bitmap:

OverlayWidth = BITMAPWIDTH(pBitmap) - pOverlayBitmap.ptOrigin.x
OverlayHeight = BITMAPHEIGHT(pBitmap) – pOverlayBitmap.ptOrigin.y

BITMAPWIDTH is a macro which determines the display bitmap width, taking the view perspective into account.

BITMAPHEIGHT is a macro which determines the display bitmap height, taking the view perspective into account.

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.

See Also

Functions:

L_ResampleBitmap, L_SizeBitmap, L_StartResize, L_Resize, L_StopResize, L_SetOverlayBitmap, L_GetOverlayBitmap, L_SetOverlayAttributes, L_GetOverlayAttributes, L_GetOverlayCount, L_BricksTextureBitmap, L_CanvasBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_VignetteBitmap

Topics:

Raster Image Functions: Combining Images

 

Overlay Overview

Example

/* This example will load an overlay bitmap and sets its color and a few attributes */
/* It assumes pBitmap is grayscale. It uses the LoadAndSetOverlay function from the L_SetOverlayBitmap example */
L_INT BurnOverlay(HWND hWnd, pBITMAPHANDLE pBitmap)
{
   L_INT nRet;

   // load overlay 0
   nRet = LoadAndSetOverlay(pBitmap, TEXT("overlay0.cmp"), 0, RGB(0, 0, 255));   // blue
   if(nRet != SUCCESS)
   {
      MessageBox(hWnd, TEXT("Error Loading Overlay 0!"), TEXT("Error"), MB_OK);
      return nRet;
   }

   nRet = L_UpdateBitmapOverlayBits(pBitmap, 0, SETOVERLAYBITS_FROMOVERLAY);
   if(nRet != SUCCESS)
      MessageBox(hWnd, TEXT("Error setting Overlay 0!"), TEXT("Error"), MB_OK);

   return nRet;
}