dHeight;
float x, y;
int lastX = 0, lastY = 0, lastWidth = 0, lastHeight = 0;
dcMem.CreateCompatibleDC(pDC);
bmp.GetBitmap(&bm);
oldWidth = bm.bmWidth;
oldHeight = bm.bmHeight;
CRect rcWnd;
pMainDlg->GetWindowRect(&rcWnd);
CBitmap bmpBkgd;
CDC dcBkgd;
dcBkgd.CreateCompatibleDC(pDC);
bmpBkgd.CreateCompatibleBitmap(pDC, rcWnd.Width() + 200, rcWnd.Height() + 200);
dcBkgd.SelectObject(&bmpBkgd);
dcBkgd.FillSolidRect(0, 0, rcWnd.Width() + 200, rcWnd.Height() + 200, RGB(255, 174 ,201));
while (1)
{
if (base <= oldWidth)
{
base += 15;
}
if (base > oldWidth && degree == 0)
{
break;
}
width = base;
height = base * ((float)oldHeight / (float)oldWidth);
hBmp = GetRotatedBitmap((HBITMAP)bmp.GetSafeHandle(), RADIAN(degree), (int)width, (int)height, RGB(255, 174 ,201));
pbmpRotated = CBitmap::FromHandle(hBmp);
dcMem.SelectObject(pbmpRotated);
pbmpRotated->GetBitmap(&bm);
x = (float)oldWidth / 2 - (float)bm.bmWidth / 2;
y = (float)oldHeight / 2 - (float)bm.bmHeight / 2;
pDC->BitBlt(lastX, lastY, lastWidth, lastHeight, &dcBkgd, 0, 0, SRCCOPY);
pDC->BitBlt((int)x, (int)y, bm.bmWidth, bm.bmHeight, &dcMem, 0, 0, SRCCOPY);
lastX = (int)x;
lastY = (int)y;
lastWidth = bm.bmWidth;
lastHeight = bm.bmHeight;
pbmpRotated->DeleteObject();
degree = (degree += 15) > 360 0 : degree;
Sleep(1);
}
dcMem.DeleteDC();
dcBkgd.DeleteDC();
bmpBkgd.DeleteObject();
EnumChildWindows(pMainDlg->GetSafeHwnd(), EnumChildProc, 1L);
// CLEAN_CODE
return 0;
}
|