Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, October 30, 2006 5:06:47 PM(UTC)

dish  
dish

Groups: Registered
Posts: 2


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...?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, October 31, 2006 5:00:22 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)




Are you trying to convert the above C++ code into DLL API
code? If yes, you can refer to our LEADTOOLS API Help file. Our LEADTOOLS Class
Library programming interface and our API mostly use similar functions names
and declarations. Actually our LEADTOOLS Class Library wraps around the API functions.


For example, the CreateAlphaBitmap function calls the L_GetBitmapAlpha internally, and so on.

If you search for the API equivalent for a C++ Class Library function and you can't find it, tell us which one it is and we will help you.

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.088 seconds.