GDI特效5

 
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);
			} 
		}
	}
}

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值