void CEffect::utdMove(HDC dc, HDC memdc, CRect rtReDraw)
{
int x = 0;
int y = 0;
LONG i = 0;
int nDeta =4;
BOOL bDone =FALSE;
while(!bDone)
{
if (i > rtReDraw.Height())
{
i = rtReDraw.Height();
bDone = TRUE;
}
BitBlt(dc,x,
y,
rtReDraw.Width(),
i+nDeta,
memdc,
0,
rtReDraw.Height()-i,
SRCCOPY);
i += nDeta;
}
}
void CEffect::ltrMove(HDC dc, HDC memdc, CRect rtReDraw)
{
int x = 0;
int y = 0;
LONG i = 0;
int nDeta =4;
BOOL bDone =FALSE;
while(!bDone)
{
if (i > rtReDraw.Width())
{
i = rtReDraw.Width();
bDone = TRUE;
}
BitBlt(dc,x,
y,
i+nDeta,
rtReDraw.Height(),
memdc,
rtReDraw.Width()-i,
0,
SRCCOPY);
i += nDeta;
}
}
void CEffect::LRTile(HDC dc, HDC memdc, CRect rtReDraw)
{
int ScreenW = GetSystemMetrics(SM_CXSCREEN);
int ScreenH = GetSystemMetrics(SM_CYSCREEN);
int HalfW = ScreenW/2 ;
int Left = HalfW;
for(int i = HalfW; i <= ScreenW; i +=1 )
{
Left = ScreenW - i;
::BitBlt(dc, Left, 0, 1, ScreenH, memdc, Left, 0, SRCCOPY);
::BitBlt(dc, i, 0, 1, ScreenH, memdc, i, 0, SRCCOPY);
}
::BitBlt(dc, rtReDraw.left, rtReDraw.top, rtReDraw.Width(), rtReDraw.Height(), memdc, 0, 0, SRCCOPY);
}
void CEffect::LRClose(HDC dc, HDC memdc, CRect rtReDraw)
{
int ScreenW = GetSystemMetrics(SM_CXSCREEN);
int ScreenH = GetSystemMetrics(SM_CYSCREEN);
int HalfW = ScreenW/2 ;
int Left = HalfW;
for(int i=0; i <= HalfW; i +=3 )
{
::BitBlt(dc, 0, 0, i, ScreenW, memdc, 0, 0, SRCCOPY);
::BitBlt(dc, ScreenW-i, 0, i, ScreenW, memdc, ScreenW-i, 0, SRCCOPY);
}
::BitBlt(dc, rtReDraw.left, rtReDraw.top, rtReDraw.Width(), rtReDraw.Height(), memdc, 0, 0, SRCCOPY);
}
void CEffect::Clock(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;
CPoint *point , *pointold;
point = new CPoint[Width];
pointold = new CPoint[Width];
for( int k = 0; k< Width; k++ )
{
point[k].x= pointold[k].x = Center.x + k;
point[k].y= pointold[k].y = 0;
}
int Start = GetTickCount();
int i;
float t;
for(t = PI/(float)2; t >= -PI*3/(float)2; t -= PI*(float)25/180 )
{
float TanValue = (float)tan(t);
if ( TanValue < -Center.y )
TanValue = (float)Center.x;
for(i = 0; i<= Width; i++ )
{
point[i].x = Center.x + i*( t > -PI/(float)2?1:-1 );
if ( t > -PI/(float)2&& t - PI*(float)5/180 < -PI/(float)2 )
{
point[i].y = rtReDraw.Height();
}
else if ( t - PI*(float)5/180 < -PI*3/(float)2)
{
point[i].y = 0;
}
else
{
point[i].y = (int)(Center.y - i*TanValue*( t > -PI/(float)2?1:-1 ) );
}
if ( point[i].y < 0 )
{
point[i].y = 0;
}
if ( point[i].x >= 0 && point[i].x < rtReDraw.Width() )
{
::BitBlt(dc, point[i].x, min(abs(pointold[i].y), abs(point[i].y) ), 1, abs(pointold[i].y-point[i].y),
memdc, point[i].x, min(abs(pointold[i].y), abs(point[i].y) ), SRCCOPY);
}
pointold[i] = point[i];
}
}
if (rtReDraw.Width() > 720)
::BitBlt(dc,0,0,rtReDraw.Width(),rtReDraw.Height(),memdc,0,0,SRCCOPY);
delete [] point;
delete [] pointold;
}
GDI特效3
最新推荐文章于 2017-03-20 10:12:56 发布
本文介绍了四个使用GDI实现的图形特效:从上到下移动、从左到右移动、瓷砖填充和闭合效果。通过BitBlt函数进行位块传输,结合Windows系统指标调整效果。还提供了一个时钟动画特效,利用三角函数模拟指针移动。
摘要由CSDN通过智能技术生成