L_UnderlayBitmap

#include "l_bitmap.h"

L_LTDIS_API L_INT L_UnderlayBitmap(pBitmapDst, pUnderlay, uFlags)

pBITMAPHANDLE pBitmapDst;

/* pointer to the target bitmap handle */

pBITMAPHANDLE pUnderlay;

/* pointer to the underlay bitmap handle */

L_UINT uFlags;

/* positioning indicators */

Combines two bitmaps so that one appears to be an underlying texture for the other. This is most effective when the underlying image is a filtered one, such as an embossed image.

Parameter

Description

pBitmapDst

Pointer to the bitmap handle that references the bitmap to be used as the target image. This is the image that appears to be on top and retains its colors.

pUnderlay

Pointer to the bitmap handle that references the bitmap to be used as the underlying image. This is the image that appears to be on bottom and is grayscaled as it is combined with the target image.

uFlags

Indicators of how the underlying image is to be positioned. Valid values are:

 

Value

Meaning

 

UB_TILE

[0x00] Tile the underlay. This repeats the underlying image, so that it fills the target image. This function does not do any resizing; you are responsible for the size of the tiles.

 

UB_STRETCH

[0x01] Stretch the underlay to fit the dimensions of the target image.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function changes the colors of the underlay to grayscale as it combines the images. It updates the target bitmap (pBitmapDst), leaving the second bitmap (pUnderlay) unchanged. The underlying image can either be stretched or tiled to fill the target image, as shown in the following illustration:

image\undlay.gif

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

If a region is defined for the target bitmap, the underlay is applied to the region, not to the whole bitmap. (Any region defined for the underlay bitmap is ignored.)

Required DLLs and Libraries

LTDIS

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

Win32, x64.

See Also

Functions:

L_CombineBitmap, L_BumpMapBitmap, L_CubismBitmap, L_DrawStarBitmap, L_DryBitmap, L_FreePlaneBendBitmap, L_FreeRadBendBitmap, L_GlassEffectBitmap, L_GlowFilterBitmap, L_LensFlareBitmap, L_LightBitmap, L_OceanBitmap, L_PlaneBendBitmap, L_PlaneBitmap, L_SampleTargetBitmap, L_TunnelBitmap, L_BendingBitmap, L_CylindricalBitmap, L_FreeHandShearBitmap, L_FreeHandWaveBitmap, L_ImpressionistBitmap, L_PixelateBitmap, L_PolarBitmap, L_PunchBitmap, L_RadialBlurBitmap, L_RadWaveBitmap, L_RippleBitmap, L_SpherizeBitmap, L_SwirlBitmap, L_WaveBitmap, L_WindBitmap, L_ZoomBlurBitmap, L_ZoomWaveBitmap, L_AddShadowBitmap, L_RevEffectBitmap, L_AgingBitmap, L_DiceEffectBitmap, L_FunctionalLightBitmap, L_PuzzleEffectBitmap, L_RingEffectBitmap, L_TextureAlphaBlendBitmap, L_BricksTextureBitmap, L_CanvasBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_VignetteBitmap, L_CloudsBitmap, L_ColoredBallsBitmap, L_DiffuseGlowBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_HalfTonePatternBitmap, L_MaskConvolutionBitmap, L_MosaicTilesBitmap, L_OffsetBitmap, L_PerspectiveBitmap, L_PlasmaFilterBitmap, L_PointillistBitmap, L_RomanMosaicBitmap, L_ZigZagBitmap

Topics:

Raster Image Functions: Copying Images

 

Processing an Image

 

Applying Artistic Effects

 

Raster Image Functions: Processing an Image

Example

For complete sample code, refer to the CLRSPACE example.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


 L_INT UnderlayBitmapExample(L_VOID)
{
   L_INT nRet;
   /* This example uses TmpBitmap as a tiled underlay for LeadBitmap */
   BITMAPHANDLE LeadBitmap;   /* Bitmap handle to hold the loaded image */
   BITMAPHANDLE TmpBitmap;    /* Temporary bitmap */

   /* Load both bitmaps, at 24 bits per pixel */
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ULAY1.BMP")), &TmpBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGR, NULL, NULL);
   if(nRet != SUCCESS)
      return nRet;

   /* Use TmpBitmap as a tiled underlay for LeadBitmap */
   nRet = L_UnderlayBitmap(&LeadBitmap, &TmpBitmap, UB_TILE);
   if(nRet != SUCCESS)
      return nRet;

   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL);
   if(nRet != SUCCESS)
      return nRet;

   /* Free the temporary bitmap */
   L_FreeBitmap(&TmpBitmap);
   L_FreeBitmap(&LeadBitmap);
   return SUCCESS;
}