Combines image data from the source bitmap (the slave) and the destination bitmap (the master), using a perspective warp.
#include "ltwrappr.h"
virtual L_INT LBitmapBase::CombineBitmapWarp (nDst, pBitmapSrc, nSrc, nSrcWidth, nSrcHeight, uFlags)
An array of POINT structures that contain the four points that define the warp area in the destination bitmap.
Pointer to the bitmap object referencing the source bitmap. This is the slave bitmap, which is combined with the destination bitmap.
POINT structure that contains the point of origin of the source bitmap. This is the upper left corner. This point, along with nSrcWidth and nSrcHeight define the area of the source bitmap to be warped.
The width of the area in the source bitmap to be warped to the destination bitmap. This value, along with ptSrc and nSrcHeight define the area of the source bitmap to be warped.
The height of the area in the source bitmap to be warped to the destination bitmap. This value, along with ptSrc and nSrcWidth define the area of the source bitmap to be warped.
Flags that indicate the type of interpolation to use, if interpolation is used. Possible values are:
Value | Meaning |
---|---|
0 | No interpolation |
CBW_BILINEAR | Bilinear interpolation. This value is only valid if the bits per pixel of the image is 1-bit, 8-bit grayscale, 12-bit without a lookup table, 16-bit without a lookup table, or 24-, 32-, 48-, or 64-bit. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
You can warp the entire source bitmap, or a portion of the source bitmap. To warp a portion of the source bitmap, set ptSrc, nSrcWidth and nSrcHeight accordingly. To warp the entire source bitmap, set the following:
ptSrc.x = 0;
ptSrc.y = 0;
nSrcWidth = pBitmapSrc.BitmapWidth;
nSrcHeight = pBitmapSrc.BitmapHeight;
The warp area in the destination bitmap is specified in nDst. The polygon specified in nDst must:
be concave.
fit entirely on the destination bitmap.
If either of these conditions is FALSE, this function will return an error.
The ordering of the points in nDst can affect the resulting warp. For example, if the source bitmap is the following:
then ordering the points in nDst as shown below results in the following warp:
while ordering the points in nDst as shown below, results in the following warp:
Win32, x64.
L_INT LBitmapBase__CombineBitmapWarpExample(LBitmap *pMaster,LBitmap *pSlave)
{
L_INT nRet;
POINT ptSrc = {0,0};
POINT aptsDest[4]=
{
{100,100},
{200,75},
{200,250},
{100,200}
};
//load images as 24-bit, so we don't have to worry about palettes
pMaster->Load(MAKE_IMAGE_PATH(TEXT("Image1.cmp")), 24, ORDER_BGR, NULL, NULL);
pSlave->Load(MAKE_IMAGE_PATH(TEXT("Image1.cmp")), 24, ORDER_BGR, NULL, NULL);
nRet =pMaster->CombineBitmapWarp(aptsDest,
pSlave,
ptSrc,
pSlave->GetWidth(), pSlave->GetHeight(),
CBW_BILINEAR);
if(nRet !=SUCCESS)
return nRet;
nRet =pMaster->Save(MAKE_IMAGE_PATH(TEXT("output.jpg")), FILE_JPEG, 0, 2, 0, NULL);
if(nRet !=SUCCESS)
return nRet;
nRet =pMaster->Free();
if(nRet !=SUCCESS)
return nRet;
nRet =pSlave->Free();
if(nRet !=SUCCESS)
return nRet;
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document