C++ Class Leadtools PRO V14
/* Image Got Alpha Channel */
{
HDC hMemDC;
HBITMAP hMemBitmap;
HBITMAP hOldBitmap;
double dResizeRatio = 1;
LBitmap MaskBitmap;
LBitmap ResizedBitmap;
LBitmap FeatherBitmap;
/* Create Background DDB to CPhotoBitmap */
hMemDC = CreateCompatibleDC(hDC);
hMemBitmap = CreateCompatibleBitmap(hDC,prcDest->right-prcDest->left,prcDest->bottom-prcDest->top);
hOldBitmap = (HBITMAP)SelectObject(hMemDC,hMemBitmap);
::SetStretchBltMode(hDC, COLORONCOLOR);
n_Ret = BitBlt(hMemDC,
0,
0,
prcDest->right-prcDest->left,
prcDest->bottom-prcDest->top,
hDC,
prcDest->left,
prcDest->top,
SRCCOPY);
if(n_Ret == 0)
{
#ifdef _DEBUG
DWORD dLastError = GetLastError();
TRACE("BitBlt FAIL (%u)",dLastError);
#endif
return FALSE;
}
n_Ret = FeatherBitmap.ConvertFromDDB(hMemDC,hMemBitmap,NULL);
if(n_Ret != SUCCESS)
{
#ifdef _DEBUG
LBase::DisplayErrorList(NULL,n_Ret);
#endif
return FALSE;
}
/* Resize For Feather AlphaBlend */
ResizedBitmap.Copy((LBitmapBase&)(m_Bitmap));
if(!(ResizedBitmap.GetWidth() == prcDest->right-prcDest->left &&
ResizedBitmap.GetHeight() == prcDest->bottom-prcDest->top))
{
ResizedBitmap.Trim(prcSrc);
ResizedBitmap.Size(prcDest->right-prcDest->left,prcDest->bottom-prcDest->top,SIZE_NORMAL);
}
/* Create Src's Mask Bitmap */
MaskBitmap.CreateAlphaBitmap((LBitmapBase&)ResizedBitmap);
/* Blend to FeatherBitmap(Background) */
n_Ret = FeatherBitmap.FeatherAlphaBlend(
0,
0,
prcDest->right-prcDest->left,
prcDest->bottom-prcDest->top,
&ResizedBitmap,
0,
0,
&MaskBitmap
);
if(n_Ret != SUCCESS)
{
#ifdef _DEBUG
LBase::DisplayErrorList(NULL,n_Ret);
#endif
return FALSE;
}
/* Set Old and Destroy */
SelectObject(hMemDC,hOldBitmap);
DeleteObject(hMemDC);
DeleteObject(hMemBitmap);
FeatherBitmap.SetDisplayMode(DISPLAYMODE_FASTPAINT|DISPLAYMODE_RESAMPLE|DISPLAYMODE_BICUBIC,uFlag);
FeatherBitmap.Paint()->SetDC(hDC);
FeatherBitmap.SetDstRect(prcDest);
n_Ret = FeatherBitmap.Paint()->PaintDC();
if(n_Ret != SUCCESS)
{
#ifdef _DEBUG
LBase::DisplayErrorList(NULL,n_Ret);
#endif
return FALSE;
}
n_Ret = TRUE;
}
return n_Ret;
how to convert Raster API Code...?