LBitmapBase::Combine

#include "ltwrappr.h"

virtual L_INT LBitmapBase::Combine(pLBitmapSrc, nWidth, nHeight, nXDst=0, nYDst=0, nXSrc=0, nYSrc=0, uFlags= CB_OP_ADD|CB_DST_0)

LBitmapBase L_FAR * pLBitmapSrc;

/* pointer to the source bitmap handle */

L_INT nWidth;

/* width of the destination rectangle */

L_INT nHeight;

/* height of the destination rectangle */

L_INT nXDst;

/* x coordinate of the origin of the destination rectangle */

L_INT nYDst;

/* y coordinate of the origin of the destination rectangle */

L_INT nXSrc;

/* x coordinate of the origin of the source rectangle */

L_INT nYSrc;

/* y coordinate of the origin of the source rectangle */

L_UINT32 uFlags;

/* flag that indicates the operations to perform */

Combines image data from two bitmaps, letting you specify the areas to be combined and the operations to be performed when combining the data.

Parameter

Description

pLBitmapSrc

Pointer to the source bitmap handle to be combined with the current bitmap object.

nWidth

The width of the rectangle, measured in pixels. The same number is used for both source and destination rectangles.

nHeight

The height of the rectangle, measured in pixels. The same number is used for both source and destination rectangles.

nXDst

The X coordinate of the origin of the destination rectangle.

nYDst

The Y coordinate of the origin of the destination rectangle.

nXSrc

The X coordinate of the origin of the source rectangle.

nYSrc

The Y coordinate of the origin of the source rectangle.

uFlags

The flags are combined into four groups that define treatment of the source, treatment of the destination, the operation to use when combining the data, and the treatment of the resulting image. The flags apply only to the defined rectangles (not necessarily the whole bitmap). You can use a bitwise OR ( | ) to specify one flag from each group. Refer to Flags for the LBitmapBase::CombineBitmap Function for the list of flags.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function combines the data byte-by-byte. Both images must have the same color resolution. Images that are 24-bits per pixel are the easiest to combine. For other color resolutions, you must ensure that the pixel and byte boundaries are aligned on the rectangle borders. Both images must use the same palette, if a palette is required.

This function uses Windows-style coordinates (with a top-left origin) to specify the areas to be combined.

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

If a region is defined for either the source or destination bitmap, or both bitmaps, the combine applies only to the intersection of regions.

Required DLLs and Libraries

LTDIS
LTFIL

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

Elements:

LBitmap::DiffuseGlow, LBitmap::MaskConvolution, LBitmap::HighPassFilter, LBitmap::UnsharpMask, LBitmap::BricksTexture, LBitmap::Canvas, LBitmap::DisplaceMap, LBitmap::Fragment, LBitmap::Vignette, Class Members

Topics:

Raster Image Functions: Copying Images

 

Processing an Image

 

Removing Noise

 

Detecting and Enhancing Edges and Lines

 

Implementing Transparency

 

Raster Image Functions: Removing Noise

 

Raster Image Functions: Detecting and Enhancing Edges and Lines

 

Raster Image Functions: Processing an Image

Example

/* This example uses the flags for a simple paste when combining
the source bitmap with the destination bitmap. */
LBitmapBase  LeadBitmap;   /* Bitmap handle to hold the loaded image */
LBitmapBase TmpBitmap; /* Temporary bitmap */

L_INT XDst;  /* Column offset of the destination */
L_INT XSize; /* Pixel width of the rectangle to combine */
L_INT YDst;  /* Row offset of the destination */
L_INT YSize; /* Pixel height of the rectangle to combine */
L_INT XSrc;  /* Column offset of the source */
L_INT YSrc;  /* Column offset of the source */
/* Load both bitmaps, at 24 bits per pixel */
LeadBitmap.Load (TEXT("IMAGE3.CMP"));
TmpBitmap.Load(TEXT("ULAY4.BMP"));

/* Specify a position in the top left part of the displayed image */
XDst = LeadBitmap.GetWidth();
YDst = LeadBitmap.GetHeight() / 8;
/* Use the full size of the source bitmap */
YSize = TmpBitmap.GetWidth();
XSize = TmpBitmap.GetHeight();
XSrc = 0;
YSrc = 0;
/* Combine TmpBitmap with LeadBitmap, using flags for an ordinary paste */
LeadBitmap.Combine(&TmpBitmap, XSize, YSize, XDst, YDst, XSrc, YSrc, CB_OP_ADD | CB_DST_0);