⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dib.cpp

📁 vc++实现简单图像编辑器。。。。。。。。。
💻 CPP
📖 第 1 页 / 共 4 页
字号:
		pDC->BitBlt (x,y+i,GetWidth(),nDeta,
			         &MemDC,0,i,dwRop);
		pDC->BitBlt (x,y+GetHeight()-i,GetWidth(),i,
			         &MemDC,0,GetHeight()-i,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_VSPLITSCAN
	case EFFECT_HSPLITSCAN:
		{ 
		if(i>GetWidth()/2)
		{
			i=GetWidth()/2;
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x+i,y,nDeta,GetHeight(),
			         &MemDC,i,0,dwRop);
		pDC->BitBlt (x+GetWidth()-i,y,nDeta,GetHeight(),
			         &MemDC,GetWidth()-i,0,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_HSPLITSCAN:
	case EFFECT_MOVEDOWN:
		{ 
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,GetWidth(),i+nDeta,
			         &MemDC,0,GetHeight()-i,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_MOVEDOWN
	case EFFECT_MOVEUP:
		{ 
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y+GetHeight()-i,GetWidth(),i,
			         &MemDC,0,0,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_MOVEDUP
	case EFFECT_MOVERIGHT:
		{ 
		if(i>GetWidth())
		{
			i=GetWidth();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,nDeta+i,GetHeight(),
			         &MemDC,GetWidth()-i,0,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_MOVERIGHT
    case EFFECT_MOVELEFT:
		{ 
		if(i>GetWidth())
		{
			i=GetWidth();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x+GetWidth()-i,y,i,GetHeight(),
			         &MemDC,0,0,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_MOVELEFT
	case EFFECT_VSPLITMOVE:
		{ 
		if(i>GetHeight()/2)
		{
			i=GetHeight()/2;
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,GetWidth(),i+nDeta,
			         &MemDC,0,GetHeight()/2-i,dwRop);
		pDC->BitBlt (x,y+GetHeight()-i,GetWidth(),i,
			         &MemDC,0,GetHeight()/2,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_VSPLITMOVE
	case EFFECT_HSPLITMOVE:
		{ 
		if(i>GetWidth()/2)
		{
			i=GetWidth()/2;
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,i+nDeta,GetHeight(),
			         &MemDC,GetWidth()/2-i,0,dwRop);
		pDC->BitBlt (x+GetWidth()-i,y,i,GetHeight(),
			         &MemDC,GetWidth()/2,0,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_HSPLITMOVE:
	case EFFECT_VCROSSMOVE:
		{ 
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,GetWidth()/2,i+nDeta,
			         &MemDC,0,GetHeight()-i,dwRop);
		pDC->BitBlt (x+GetWidth()/2,GetHeight()-i,GetWidth(),i,
			         &MemDC,GetWidth()/2,0,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_VCROSSMOVE
	case EFFECT_HCROSSMOVE:
		{ 
		if(i>GetWidth())
		{
			i=GetWidth();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,i+nDeta,GetHeight()/2,
			         &MemDC,GetWidth()-i,0,dwRop);
		pDC->BitBlt (x+GetWidth()-i,y+GetHeight()/2,i,GetHeight()/2,
			         &MemDC,0,GetHeight()/2,dwRop);
		i+=nDeta;
		break;
		}//end of case EFFECT_HCROSSMOVE
	case EFFECT_VRASTER:
		{ 
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		long j=0;
		BOOL bQuitLoop=FALSE;
		while(!bQuitLoop)
		{
			if(j>GetWidth())
			{
				j=GetWidth();
				bQuitLoop=TRUE;
			}
			pDC->BitBlt (x+j,y,nDeta,i+1,
				&MemDC,j,GetHeight()-i,dwRop);
			j+=nDeta;
			if(j>GetWidth())
			{
				j=GetWidth();
				bQuitLoop=TRUE;
			}
			pDC->BitBlt (x+j,y+GetHeight()-i,nDeta,i,
				&MemDC,j,0,dwRop);
			j+=nDeta;
		}//end of while
		i++;
		break;		
		}//end of case EFFECT_VRASTER
	case EFFECT_HRASTER:
		{ 
		   if(i>GetWidth())
		   {
			i=GetWidth();
			bDone=TRUE;
		   }//end if 
		long j=0;
		BOOL bQuitLoop=FALSE;
		while(!bQuitLoop)
		{
			if(j>GetHeight())
			{
				j=GetHeight();
				bQuitLoop=TRUE;
			}
			pDC->BitBlt (x,y+j,i+1,nDeta,
				&MemDC,GetWidth()-i,j,dwRop);
			j+=nDeta;
			if(j>GetHeight())
			{
				j=GetHeight();
				bQuitLoop=TRUE;
			}
			pDC->BitBlt (x+GetWidth()-i,y+j,i,nDeta,
				&MemDC,0,j,dwRop);
			j+=nDeta;
		}//end of while
		i++;
		break;		
		
		}//end of case EFFECT_HRASTER
	case EFFECT_HBLIND:
		{ 
		if(i>nDeta)
		{
			i=nDeta;
			bDone=TRUE;
		}//end if 
		for(long j=i;j<GetHeight();j+=nDeta)
			pDC->BitBlt (x,y+j,GetWidth(),1,
			         &MemDC,0,j,dwRop);
		i++;
		break;
		}//end of case EFFECT_HBLIND
	case EFFECT_VBLIND:
		{ 
		if(i>nDeta)
		{
			i=nDeta;
			bDone=TRUE;
		}//end if 
		for(long j=i;j<GetWidth();j+=nDeta)
			pDC->BitBlt (x+j,y,1,GetHeight(),
			         &MemDC,j,0,dwRop);
		i++;
		break;
		}//end of case EFFECT_VBLIND
    
	  }//end of switch
	Delay(dwDelayTime);
	}//end of while

	MemDC.SelectObject (pOldBmp);
	pDC->SelectPalette (pOldPal,TRUE);
	return TRUE;
    

	
}
BOOL CDib::Clear(int nEffect,CDC *pDC,int x,int y,int nDeta,
		         DWORD dwDelayTime)
{
	if(nEffect==EFFECT_FADE)
		return DisplayFadeOut(pDC,x,y,nDeta,dwDelayTime);
	else if(nEffect==EFFECT_MOSIAC)
		return DisplayMosiacOut(pDC,x,y,nDeta,dwDelayTime);

	CDC MemDC;
	MemDC.CreateCompatibleDC (pDC);
	CBitmap* pOldBmp=MemDC.SelectObject (m_pBitmap);
	CPalette* pOldPal=pDC->SelectPalette (m_pPalette,TRUE);
	pDC->RealizePalette ();
    CBrush fillBrush(RGB(0,0,0));
	CBrush* pOldBrush=pDC->SelectObject (&fillBrush);
	long i=0;
	BOOL bDone=FALSE;
	while(!bDone)
	{

    switch(nEffect)
	{
   	case EFFECT_SCANDOWN:
		{ 
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		pDC->Rectangle (x,y+i,x+GetWidth(),y+nDeta);
		i+=nDeta;
		break;
		}//end of case EFFECT_SCANDOWN
	case EFFECT_SCANUP:
		{ 
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		pDC->Rectangle (x,y+GetHeight()-i,
			     x+GetWidth(),y+nDeta+GetHeight()-i);
		i+=nDeta;
		break;
		}//end of case EFFECT_SCANDUP
	case EFFECT_SCANRIGHT:
		{ 
		if(i>GetWidth())
		{
			i=GetWidth();
			bDone=TRUE;
		}//end if 
		pDC->Rectangle (x+i,y,x+nDeta,y+GetHeight());
		i+=nDeta;
		break;
		}//end of case EFFECT_SCANRIGHT
    case EFFECT_SCANLEFT:
		{ 
		if(i>GetWidth())
		{
			i=GetWidth();
			bDone=TRUE;
		}//end if 
		pDC->Rectangle (x+GetWidth()-i,y,
			            x+nDeta+GetWidth()-i,y+GetHeight());
		i+=nDeta;
		break;
		}//end of case EFFECT_SCANLEFT
	case EFFECT_VSPLITSCAN:
		{ 
		if(i>GetHeight()/2)
		{
			i=GetHeight()/2;
			bDone=TRUE;
		}//end if 
		pDC->Rectangle (x,y+i,x+GetWidth(),y+i+nDeta);
		pDC->Rectangle (x,y+GetHeight()-i,
			x+GetWidth(),y+GetHeight());
		i+=nDeta;
		break;
		}//end of case EFFECT_VSPLITSCAN
	case EFFECT_HSPLITSCAN:
		{ 
		if(i>GetWidth()/2)
		{
			i=GetWidth()/2;
			bDone=TRUE;
		}//end if 
		pDC->Rectangle (x+i,y,x+i+nDeta,y+GetHeight());
		pDC->Rectangle (x+GetWidth()-i,y,
			            x+GetWidth(),y+GetHeight());
		i+=nDeta;
		break;
		}//end of case EFFECT_HSPLITSCAN:
	case EFFECT_MOVEDOWN:
		{ 	
		i+=nDeta;
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y+i,GetWidth(),GetHeight()-i,
			         &MemDC,0,0,SRCCOPY);
		pDC->Rectangle (x,y+i-nDeta,x+GetWidth(),y+i);
	
		break;
		}//end of case EFFECT_MOVEDOWN
	case EFFECT_MOVEUP:
		{ 
		i+=nDeta;
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,GetWidth(),GetHeight()-i,
			         &MemDC,0,i,SRCCOPY);
		pDC->Rectangle (x,y+GetHeight()-i,
			            x+GetWidth(),y+GetHeight());
		
		break;
		}//end of case EFFECT_MOVEDUP
	case EFFECT_MOVERIGHT:
		{ 
		i+=nDeta;
		if(i>GetWidth())
		{
			i=GetWidth();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x+i,y,GetWidth()-i,GetHeight(),
			         &MemDC,0,0,SRCCOPY);
		pDC->Rectangle (x+i-nDeta,y,x+i,y+GetHeight());
		
		break;
		}//end of case EFFECT_MOVERIGHT
    case EFFECT_MOVELEFT:
		{ 
		i+=nDeta;
		if(i>GetWidth())
		{
			i=GetWidth();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,GetWidth()-i,GetHeight(),
			         &MemDC,i,0,SRCCOPY);
		pDC->Rectangle (x+GetWidth()-i,y,
			 x+GetWidth(),y+GetHeight());
		break;
		}//end of case EFFECT_MOVELEFT
	case EFFECT_VCROSSMOVE:
		{ 
		i+=nDeta;
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y+i,GetWidth()/2,GetHeight()-i,
			         &MemDC,0,0,SRCCOPY);
	    pDC->Rectangle (x,y+i-nDeta,x+GetWidth()/2,y+i);

		pDC->BitBlt (x+GetWidth()/2,y,GetWidth(),y+GetHeight()-i,
			         &MemDC,GetWidth()/2,i,SRCCOPY);
		pDC->Rectangle (x+GetWidth()/2,y+GetHeight()-i,
			         x+GetWidth(),y+GetHeight());
		
		break;
		}//end of case EFFECT_VCROSSMOVE
	case EFFECT_HCROSSMOVE:
		{ 
		i+=nDeta;
		if(i>GetWidth())
		{
			i=GetWidth();
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x+i,y,GetWidth()-i,GetHeight()/2,
			         &MemDC,0,0,SRCCOPY);
		pDC->Rectangle (x+i-nDeta,y,x+i,y+GetHeight()/2);

		pDC->BitBlt (x,y+GetHeight()/2,GetWidth()-i,GetHeight(),
			         &MemDC,i,GetHeight()/2,SRCCOPY);
		pDC->Rectangle (x+GetWidth()-i,y+GetHeight()/2,
			         x+GetWidth(),y+GetHeight());
		
		
		break;
		}//end of case EFFECT_HSPLITMOVE:
	case EFFECT_VSPLITMOVE:
		{ 
		i+=nDeta;
		if(i>GetHeight()/2)
		{
			i=GetHeight()/2;
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,GetWidth(),GetHeight()/2-i,
			         &MemDC,0,i,SRCCOPY);
		pDC->BitBlt (x,y+GetHeight()/2+i,GetWidth(),GetHeight()/2-i,
			         &MemDC,0,GetHeight()/2,SRCCOPY);
		pDC->Rectangle (x,y+GetHeight()/2-i,
			           x+GetWidth(),y+GetHeight()/2+i+1);
		
		break;
		}//end of case EFFECT_VSPLITMOVE
	case EFFECT_HSPLITMOVE:
		{ 
		i+=nDeta;
		if(i>GetWidth()/2)
		{
			i=GetWidth()/2;
			bDone=TRUE;
		}//end if 
		pDC->BitBlt (x,y,GetWidth()/2-i,GetHeight(),
			         &MemDC,i,0,SRCCOPY);
		pDC->BitBlt (x+GetWidth()/2+i,y,GetWidth()/2-i,GetHeight(),
			         &MemDC,GetWidth()/2,0,SRCCOPY);
	    pDC->Rectangle (x+GetWidth()/2-i,y,
			           x+GetWidth()/2+i+1,y+GetHeight());
		
		break;
		}//end of case EFFECT_HSPLITMOVE
	case EFFECT_VRASTER:
		{ 
		if(i>GetHeight())
		{
			i=GetHeight();
			bDone=TRUE;
		}//end if 
		long j=0;
		BOOL bQuitLoop=FALSE;
		while(!bQuitLoop)
		{
			if(j>GetWidth())
			{
				j=GetWidth();
				bQuitLoop=TRUE;
			}
			pDC->BitBlt (x+j,y+i,nDeta,GetHeight()-i,
				&MemDC,j,0,SRCCOPY);
			pDC->Rectangle (x+j,y+i-1,
			           x+j+nDeta,y+i);

			j+=nDeta;
			if(j>GetWidth())
			{
				j=GetWidth();
				bQuitLoop=TRUE;
			}
			pDC->BitBlt (x+j,y,nDeta,GetHeight()-i,
				&MemDC,j,i,SRCCOPY);
			pDC->Rectangle (x+j,y+GetHeight()-i,
			           x+j+nDeta,y+GetHeight());
			j+=nDeta;
		}//end of while
		i++;
		break;		
		}//end of case EFFECT_VRASTER
	case EFFECT_HRASTER:
		{ 
		   if(i>GetWidth())
		   {
			i=GetWidth();
			bDone=TRUE;
		   }//end if 
		long j=0;
		BOOL bQuitLoop=FALSE;
		while(!bQuitLoop)
		{
			if(j>GetHeight())
			{
				j=GetHeight();
				bQuitLoop=TRUE;
			}
			pDC->BitBlt (x+i,y+j,GetWidth()-i,nDeta,
				&MemDC,0,j,SRCCOPY);
			pDC->Rectangle (x+i-1,y+j,x+i,y+j+nDeta);
			j+=nDeta;
			if(j>GetHeight())
			{
				j=GetHeight();
				bQuitLoop=TRUE;
			}
			pDC->BitBlt (x,y+j,GetWidth()-i,nDeta,
				&MemDC,i,j,SRCCOPY);
			pDC->Rectangle (x+GetWidth()-i,y+j,
				            x+GetWidth(),y+j+nDeta);
			j+=nDeta;
		}//end of while
		i++;
		break;		
		
		}//end of case EFFECT_HRASTER
	case EFFECT_HBLIND:
		{ 
		if(i>nDeta)
		{
			i=nDeta;
			bDone=TRUE;
		}//end if 
		for(long j=i;j<GetHeight();j+=nDeta)
			pDC->Rectangle (x,y+j,x+GetWidth(),y+j+1);
		i++;
		break;
		}//end of case EFFECT_HBLIND
	case EFFECT_VBLIND:
		{ 
		if(i>nDeta)
		{
			i=nDeta;
			bDone=TRUE;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -