void CEffect::fourRotation(HDC dc, HDC memdc, CRect rtReDraw)
{
const double PI = 3.141592653589793f;
CPoint Center(rtReDraw.Width()/2, rtReDraw.Height()/2);
int Width = rtReDraw.Width()-Center.x;
if ( Width < rtReDraw.Height() - Center.y )
{
Width = rtReDraw.Height() - Center.y;
}
CPoint *point , *pointold;
CPoint tmppoint, tmppointold;
point = new CPoint[Width+1];
pointold = new CPoint[Width+1];
for( int k = 0; k< Width+1; k++ )
{
point[k].x= pointold[k].x = k;
point[k].y= pointold[k].y = Width;
}
int i;
float t;
int MaxWidth = max(Center.y, Center.x);
for(t = PI/(float)2; t >= 0; t -= PI*(float)5/180 )
{
float TanValue = (float)tan(t);
if ( TanValue < -Center.y )
{
TanValue = (float)Center.x;
}
{
for(i = 0; i<= Width; i++ )
{
if ( t > 0&& t - PI*(float)5/180 < 0 )
{
point[i].y = 0;
}
else
{
point[i].y = int(i*TanValue);
if ( point[i].y > MaxWidth )
{
point[i].y = MaxWidth;
}
}
if ( point[i].y < 0 )
{
point[i].y = 0;
}
if ( Center.x + point[i].x >= 0 &&Center.x + point[i].x <= rtReDraw.Width() )
{
//90到0度
::BitBlt(dc, Center.x + point[i].x, Center.y -pointold[i].y, 1, pointold[i].y-point[i].y,
memdc, Center.x + point[i].x, Center.y -pointold[i].y, SRCCOPY);
//-90到-180度
::BitBlt(dc, Center.x - point[i].x, Center.y +point[i].y, 1, pointold[i].y-point[i].y,
memdc, Center.x - point[i].x, Center.y +point[i].y, SRCCOPY);
tmppoint.x = point[i].y;
tmppoint.y = -point[i].x;
tmppointold.x = pointold[i].y;
tmppointold.y = -pointold[i].x;
//0到-90度
::BitBlt(dc, Center.x + tmppoint.x, Center.y - tmppointold.y, abs(tmppoint.x - tmppointold.x), 1,
memdc, Center.x + tmppoint.x, Center.y - tmppointold.y, SRCCOPY);
//-180到-270度
::BitBlt(dc, Center.x - tmppointold.x, Center.y + tmppointold.y, abs(tmppoint.x - tmppointold.x), 1,
memdc, Center.x - tmppointold.x, Center.y + tmppointold.y, SRCCOPY);
}
pointold[i] = point[i];
}
}
}
delete [] point;
delete [] pointold;
}
void CEffect::dtuBlind(HDC dc, HDC memdc, CRect rtReDraw)
{
int Height = rtReDraw.Height()/15;
int i , j;
for( i = 0; i < Height; i++ )
{
for(j = 0; j <= 15; j++ )
{
if ( j*Height+ i < rtReDraw.Height() )
{
::BitBlt(dc, 0, j*Height+ i, rtReDraw.Width(),1, memdc,0,j*Height+ i, SRCCOPY);
}
}
Sleep(10);
}
}
void CEffect::ltrBlind(HDC dc, HDC memdc, CRect rtReDraw)
{
int Width = rtReDraw.Width()/10;
int i , j;
for( i = 0; i < Width; i++ )
{
for(j = 0; j <= 10; j++ )
{
if ( j*Width+ i < rtReDraw.Width() )
{
::BitBlt(dc, j*Width+ i, 0, 1, rtReDraw.Height(), memdc, j*Width+ i, 0, SRCCOPY);
}
}
//延时 最多10ms
double w = 0;
DWORD Start = GetTickCount();
if (rtReDraw.Width() < 720)
{
for(j = 0; j< 50; j++)
{
if ( GetTickCount() - Start > 10)
break;
w = 100.1*100.1;
CString str;
str.Format(L"%d", w);
}
}
}
}
void CEffect::utdOeErase(HDC dc, HDC memdc, CRect rtReDraw)
{
int Half = rtReDraw.Height()/2;
if (Half&1)
{
Half++;
}
if ( Half&1 )
{
++ Half;
}
for(int k = 0; k<=Half; k+=2)
{
if ( 2*k < rtReDraw.Height() )
{
::BitBlt(dc, 0, 2*k, rtReDraw.Width(), 2, memdc, 0, 2*k, SRCCOPY);
}
if ( 2*(Half-k+1) < rtReDraw.Height() && 2*(Half-k+1) >= 0 )
{
::BitBlt(dc, 0, 2*(Half-k+1), rtReDraw.Width(), 2, memdc, 0, 2*(Half-k+1), SRCCOPY);
}
double w = 0;
DWORD Start = GetTickCount();
for(int j = 0; j< 40; j++)
{
if ( GetTickCount() - Start > 10)
{
break;
}
w = 100.1*100.1;
CString str;
str.Format(L"%d", w);
}
}
}
void CEffect::ltrSingleRefresh(HDC dc, HDC memdc, CRect rtReDraw)
{
int Width = rtReDraw.Width()/10;
int Height = rtReDraw.Height()/10;
for(int i = 0; i < 11 ; i ++ )
{
if ( i*Width >= rtReDraw.Width() )
{
break;
}
for( int j = 0; j < 11; j++ )
{
if ( j*Height >= rtReDraw.Height() )
{
break;
}
BitBlt(dc, i*Width, j*Height, Width, Height, memdc, i*Width, j*Height, SRCCOPY );
double w = 0;
for(int j = 0; j< 100; j++)
{
w = 100.1*100.1;
CString str;
str.Format(L"%d", w);
}
}
}
}
GDI特效5
最新推荐文章于 2018-05-19 16:42:04 发布