double x = m_ptCenterBk.x + m_ptCenterPt.y * sin(fPos); double y = m_ptCenterBk.y - m_ptCenterPt.y * cos(fPos);
double x1 = x - m_ptCenterPt.x*cos(fPos); double y1 = y - m_ptCenterPt.x*sin(fPos); double x2 = x + m_ptCenterPt.x*cos(fPos); double y2 = y + m_ptCenterPt.x*sin(fPos);
double X = m_ptCenterBk.x - (sizePt.cy-m_ptCenterPt.y) * sin(fPos); double Y = m_ptCenterBk.y + (sizePt.cy-m_ptCenterPt.y) * cos(fPos); double x3 = X - m_ptCenterPt.x * cos(fPos); double y3 = Y - m_ptCenterPt.x * sin(fPos);
Point destinationPoints[] = { Point(INT(x1), INT(y1)), // destination for upper-left point of original Point(INT(x2), INT(y2)), // destination for upper-right point of original Point(INT(x3), INT(y3)) };// destination for lower-left point of original graphics.DrawImage(m_hbmpPointer, destinationPoints, 3);
你所说的风吹效果倒是没实现过
我理解错了,我理解成风吹树叶了,如果是风吹树叶,可以把树叶做成透明png。gdi+转图片的代码类似于下面的:
CRect rcClient;
GetClientRect(rcClient);
Gdiplus::Graphics graphics(pDC->GetSafeHdc());
// draw background
Gdiplus::Rect rect(0, 0, rcClient.Width(), rcClient.Height());
graphics.DrawImage(m_hbmpBk, rect, 0, 0, rcClient.Width(), rcClient.Height(), Gdiplus::UnitPixel);
// draw pointer
#define PAI 3.1415926
CSize sizePt;
GetBITMAPOBJSize2(m_hbmpPointer, &sizePt);
double fPos = 2*PAI*(double)m_nPos/double(m_nMax-m_nMin);
double x = m_ptCenterBk.x + m_ptCenterPt.y * sin(fPos);
double y = m_ptCenterBk.y - m_ptCenterPt.y * cos(fPos);
double x1 = x - m_ptCenterPt.x*cos(fPos);
double y1 = y - m_ptCenterPt.x*sin(fPos);
double x2 = x + m_ptCenterPt.x*cos(fPos);
double y2 = y + m_ptCenterPt.x*sin(fPos);
double X = m_ptCenterBk.x - (sizePt.cy-m_ptCenterPt.y) * sin(fPos);
double Y = m_ptCenterBk.y + (sizePt.cy-m_ptCenterPt.y) * cos(fPos);
double x3 = X - m_ptCenterPt.x * cos(fPos);
double y3 = Y - m_ptCenterPt.x * sin(fPos);
Point destinationPoints[] = {
Point(INT(x1), INT(y1)), // destination for upper-left point of original
Point(INT(x2), INT(y2)), // destination for upper-right point of original
Point(INT(x3), INT(y3)) };// destination for lower-left point of original
graphics.DrawImage(m_hbmpPointer, destinationPoints, 3);