LBitmapBase::CombineExt

#include "ltwrappr.h"

virtual L_INT LBitmapBase::CombineExt(pBitmapSrc, nWidth, nHeight, nXDst, nYDst, nXSrc, nYSrc, uFlag)

LBitmapBase * pBitmapSrc;

/* pointer to an LBitmapBase object */

L_INT nWidth;

/* width of the rectangle, measured in pixels */

L_INT nHeight;

/* height of the rectangle, measured in pixels */

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 uFlag;

/* operation flags */

Combines the image data of both the class object’s bitmap (the destination bitmap) and the specified bitmap (the source bitmap), letting you specify the areas to be combined, the operations to be performed when combining the data, and which color planes (R or G or B or R, G, and B) are used. The class object’s bitmap is updated with the result of this operation.

Parameter

Description

pBitmapSrc

Pointer to an LBitmapBase object that contains the source bitmap, which is combined with the class object's bitmap.

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.

uFlag

The flags are combined into seven groups that define treatment of the source, treatment of the destination, the operation to use when combining the data, treatment of the resulting image, and the color plan for the destination, source and resulting images. 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::CombineExt Function for the list of flags.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

For example, suppose you use the LBitmap::SpatialFilter function to apply an edge detection filter. You can then use this function to combine the resulting bitmap with the original one to produce an image with hard edges.

This function combines the data byte-by-byte. The two images can be any color resolution. Images that are 24-bits per pixel are the easiest and fastest to combine. This function uses Windows-style coordinates (with a top-left origin) to specify the areas to be combined.

If the channel setting for one of the bitmaps is the master channel (CB_SRC_MASTER, CB_DST_MASTER, CB_RES_MASTER) the settings for all the bitmaps will be set to master.

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.

For example, assume CB_SRC_RED is passed for the source bitmap, CB_DST_BLUE is passed for the destination bitmap and CB_RES_GREEN is passed for the resulting bitmap. In this case, the green channel of the resulting bitmap is calculated as the result of the operations applied to the red channel of the source bitmap and the blue channel of the destination bitmap. The other channels of the resulting bitmap are unchanged.

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.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

Required DLLs and Libraries

LTIMG
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

Functions:

LBitmap::BricksTexture, LBitmap::Canvas, LBitmap::DisplaceMap, LBitmap::Fragment, LBitmap::Vignette, LBitmapBase::Underlay, LBitmapBase::Combine, Class Members

Topics:

Raster Image Functions: Combining Images

 

Processing an Image

 

Raster Image Functions: Processing an Image

Example

L_VOID TestFunction(LBitmapBase & Bitmap, L_TCHAR * pszFile1,
                    L_TCHAR * pszFile2)
{
   LBitmapBase BitmapSrc;
   
   Bitmap.Load(pszFile1, 24, ORDER_BGR);
   BitmapSrc.Load(pszFile2, 8, ORDER_BGR);

   BitmapSrc.Size(2 * Bitmap.GetWidth() / 3,
                  2 * Bitmap.GetHeight() / 3,
                  SIZE_RESAMPLE);

   Bitmap.CombineExt(&BitmapSrc,
                     BitmapSrc.GetWidth(),
                     BitmapSrc.GetHeight(),
                     Bitmap.GetWidth() / 6,
                     Bitmap.GetHeight() / 6,
                     0,
                     0,
                     CB_OP_ADD | CB_DST_0 |CB_SRC_RED|CB_DST_GREEN |
                     CB_RES_BLUE);
}