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

📄 hdcbitblt.c

📁 lgui_0.3.0.rar
💻 C
📖 第 1 页 / 共 2 页
字号:
					GetLineFromScreen(rcOut.left,y,rcOut.right-rcOut.left+1,pData);				}			}			pClipRect=pClipRect->pNext;		}		break;	case SRCAND:	//	Combines by using the Boolean AND operator.		ScreenToClientRect(hdcDest->hWnd,&rcDest);		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top,					winGetPixel(hdcDest,x+rcDest.left, y+rcDest.top) &					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	case SRCPAINT:	//	Combines by using the Boolean OR operator.		ScreenToClientRect(hdcDest->hWnd,&rcDest);		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top, 					winGetPixel(hdcDest,x+rcDest.left, y+rcDest.top) |					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	case SRCINVERT:	//	Combines by using the Boolean XOR operator.		ScreenToClientRect(hdcDest->hWnd,&rcDest);		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top,					winGetPixel(hdcDest,x+rcDest.left, y+rcDest.top) ^					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	default:		break;	}	return true;}//Mem --> WinBOOL BitBltM2W(	HDC hdcDest, 	int nXDest, 	int nYDest, 	int nWidth, 	int nHeight,	HDC hdcSrc, 	int nXSrc, 	int nYSrc, 	DWORD dwRop){	int iSrcWidth,iSrcHeight;			//width & height of source DC	int iDestWidth,iDestHeight;			//width & height of target DC	int iSrcRectWidth,iSrcRectHeight;	//width and height clipped by bound of source DC	int iDestRectWidth,iDestRectHeight;	//width and height clipped by bound of dest DC	int iCopyWidth,iCopyHeight;			//result area calculated to copy	int x,y;	PCOLORREF pSrcData;	void* pData;	RECT rcSrc,rcDest;	RECT rcOut;	PWindowsTree pWin;	//PClipRegion	pClipRgn;	PClipRect	pClipRect;	pWin=(PWindowsTree)(hdcDest->hWnd);	iDestWidth	=pWin->rect.right - pWin->rect.left +1;	iDestHeight	=pWin->rect.bottom - pWin->rect.top +1;	iSrcWidth	=((PBITMAP)(hdcSrc->hBitmap))->bmWidth;	iSrcHeight	=((PBITMAP)(hdcSrc->hBitmap))->bmHeight;	WindowToScreen(hdcDest->hWnd,&nXDest,&nYDest);	if(nXDest>pWin->rect.right)		return false;	if(nYDest>pWin->rect.bottom)		return false;	if(nXSrc>=iSrcWidth)		return false;	if(nYSrc>=iSrcHeight)		return false;	pSrcData	=(PCOLORREF)(hdcSrc->pData);	//Source	if(nXSrc + nWidth	<= iSrcWidth)		iSrcRectWidth	=nWidth;	else		iSrcRectWidth	=iSrcWidth - nXSrc;	if(nYSrc + nHeight	<= iSrcHeight)		iSrcRectHeight	=nHeight;	else		iSrcRectHeight	=iSrcHeight - nYSrc;	//Dest	if(nXDest + nWidth	<= pWin->rect.right)		iDestRectWidth	=nWidth;	else		iDestRectWidth	=pWin->rect.right - nXDest + 1;	if(nYDest + nHeight	<= pWin->rect.bottom)		iDestRectHeight	=nHeight;	else		iDestRectHeight	=pWin->rect.bottom - nYDest + 1;	iCopyWidth	=min(iSrcRectWidth,iDestRectWidth);	iCopyHeight	=min(iSrcRectHeight,iDestRectHeight);	//source	rcSrc.left		=nXSrc;	rcSrc.top		=nYSrc;	rcSrc.right		=nXSrc + iCopyWidth - 1;	rcSrc.bottom	=nYSrc + iCopyHeight -1;	//Dest	rcDest.left		=nXDest;	rcDest.top		=nYDest;	rcDest.right	=nXDest + iCopyWidth - 1;	rcDest.bottom	=nYDest + iCopyHeight -1;	//begin copy here	switch(dwRop){	case SRCCOPY:	//	Copies the source winRectangle directly		pClipRect=pWin->pClipRgn->pHead;		if(IsIntersect(&(pWin->pClipRgn->rcBound),&rcDest)){			RequestPaint(&rcDest);			while(pClipRect){				if(IntersectRect(&rcOut,&(pClipRect->rect),&rcDest)){					for(y=rcOut.top;y<=rcOut.bottom;y++){						pData=(void*)(pSrcData							+ ((rcSrc.top + y - rcDest.top)*iSrcWidth							+ rcSrc.left + rcOut.left - rcDest.left));						PaintLine2ScreenRAW(rcOut.left,y,rcOut.right-rcOut.left+1,pData);					}				}				pClipRect=pClipRect->pNext;			}			CompletePaint();		}		break;	case SRCAND:			ScreenToClientRect(hdcDest->hWnd,&rcDest);		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top,					winGetPixel(hdcDest,x+rcDest.left, y+rcDest.top) &					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	case SRCPAINT:	//	Combines by using the Boolean OR operator.		ScreenToClientRect(hdcDest->hWnd,&rcDest);		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top,					winGetPixel(hdcDest,x+rcDest.left, y+rcDest.top) |					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	case SRCINVERT:	//	Combines by using the Boolean XOR operator.		ScreenToClientRect(hdcDest->hWnd,&rcDest);		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top,					winGetPixel(hdcDest,x+rcDest.left, y+rcDest.top) ^					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	default:		break;	}	return true;}//Win->WinBOOL BitBltW2W(	HDC hdcDest, 	int nXDest, 	int nYDest, 	int nWidth, 	int nHeight,	HDC hdcSrc, 	int nXSrc, 	int nYSrc, 	DWORD dwRop){	int iSrcWidth,iSrcHeight;			//width & height of source DC	int iDestWidth,iDestHeight;			//width & height of target DC	int iSrcRectWidth,iSrcRectHeight;	//width and height clipped by bound of source DC	int iDestRectWidth,iDestRectHeight;	//width and height clipped by bound of dest DC	int iCopyWidth,iCopyHeight;			//result area calculated to copy	int x,y;	RECT rcSrc,rcDest;	PWindowsTree pSrcWin,pDestWin;	pSrcWin=(PWindowsTree)(hdcSrc->hWnd);	pDestWin=(PWindowsTree)(hdcDest->hWnd);	iSrcWidth	=pSrcWin->rect.right - pSrcWin->rect.left +1;	iSrcHeight	=pSrcWin->rect.bottom - pSrcWin->rect.top +1;	iDestWidth	=pDestWin->rect.right - pDestWin->rect.left +1;	iDestHeight	=pDestWin->rect.bottom - pDestWin->rect.top +1;	ClientToScreen(hdcSrc->hWnd,&nXSrc,&nYSrc);		ClientToScreen(hdcSrc->hWnd,&nXSrc,&nYSrc);	if(nXSrc>pSrcWin->rect.right)		return false;	if(nYSrc>pSrcWin->rect.bottom)		return false;	if(nXDest>pDestWin->rect.right)		return false;	if(nYDest>pDestWin->rect.bottom)		return false;	//Dest	if(nXDest + nWidth	<= pDestWin->rect.right)		iDestRectWidth	=nWidth;	else		iDestRectWidth	=pDestWin->rect.right - nXDest + 1;	if(nYDest + nHeight	<= pDestWin->rect.bottom)		iDestRectHeight	=nHeight;	else		iDestRectHeight	=pDestWin->rect.bottom - nYDest;		//Src	if(nXSrc + nWidth	<= pSrcWin->rect.right)		iSrcRectWidth	=nWidth;	else		iSrcRectWidth	=pSrcWin->rect.right - nXSrc + 1;	if(nYSrc + nHeight	<= pSrcWin->rect.bottom)		iSrcRectHeight	=nHeight;	else		iSrcRectHeight	=pSrcWin->rect.bottom - nYSrc + 1;	iCopyWidth	=min(iSrcRectWidth,iDestRectWidth);	iCopyHeight	=min(iSrcRectHeight,iDestRectHeight);		//source	rcSrc.left		=nXSrc;	rcSrc.top		=nYSrc;	rcSrc.right		=nXSrc + iCopyWidth - 1;	rcSrc.bottom	=nYSrc + iCopyHeight -1;	//Dest	rcDest.left		=nXDest;	rcDest.top		=nYDest;	rcDest.right	=nXDest + iCopyWidth - 1;	rcDest.bottom	=nYDest + iCopyHeight -1;	//begin copy here	ScreenToClientRect(hdcDest->hWnd,&rcDest);	switch(dwRop){	case SRCCOPY:	//	Copies the source winRectangle directly		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top, 					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	case SRCAND:	//	Combines by using the Boolean AND operator.		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top, 					winGetPixel(hdcDest,x+rcDest.left, y+rcDest.top) &					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	case SRCPAINT:	//	Combines by using the Boolean OR operator.		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top, 					winGetPixel(hdcDest,x+rcDest.left, y+rcDest.top) |					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	case SRCINVERT:	//	Combines by using the Boolean XOR operator.		for(y=0;y<iCopyHeight;y++){			for(x=0;x<iCopyWidth;x++){				winSetPixel(hdcDest, x+rcDest.left, y+rcDest.top, 					winGetPixel(hdcDest,x+rcDest.left, y+rcDest.top) ^					winGetPixel(hdcSrc,x+rcSrc.left,y+rcSrc.top));			}		}		break;	default:		break;	}	return true;}

⌨️ 快捷键说明

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