|
|
//Directdraw 变量
LPDIRECTDRAW7 lpDDraw7 =NULL; //Directdraw对象
LPDIRECTDRAWSURFACE7 lpDDprimary =NULL; //Directdraw主画面
LPDIRECTDRAWSURFACE7 lpDDback =NULL; //Directdraw后备画面
LPDIRECTDRAWSURFACE7 lpDDbpic =NULL; //Directdraw备用画面
DDSURFACEDESC2 ddsd; //Directdraw表面描叙界面
DDBLTFX ddbltfx; //Directdraw图形变换变量
LPDIRECTDRAWCLIPPER lpDDclip =NULL; //Directdraw剪切板
BMPPIC bitmap; //BMP 位图
/////////////////////////////////////////////
//DirectDraw剪切板
/////////////////////////////////////////////
LPDIRECTDRAWCLIPPER CreatDDClipper(LPDIRECTDRAWSURFACE7 lpDDraw,
int Clipnumber,
LPRECT clipsqe)
{
int index;
LPDIRECTDRAWCLIPPER lpDDtempclip; //Directdraw 剪切板
LPRGNDATA clipregion ; //剪切区域序列
//创建剪切板
if (FAILED(lpDDraw7->CreateClipper(0,&lpDDtempclip,NULL)))
{
MessageBox(NULL,TEXT("DirectDraw Create clipper error!"),
TEXT("Wrong!"),MB_OK);
return(NULL);
}
//定义剪切区
clipregion = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER)+Clipnumber*sizeof(RECT));
memcpy(clipregion->Buffer,clipsqe,sizeof(RECT)*Clipnumber);
clipregion->rdh.dwSize = sizeof(RGNDATAHEADER);
clipregion->rdh.iType = RDH_RECTANGLES;
clipregion->rdh.nCount = Clipnumber;
clipregion->rdh.nRgnSize = Clipnumber*sizeof(RECT);
clipregion->rdh.rcBound.left = 80000;
clipregion->rdh.rcBound.top = 80000;
clipregion->rdh.rcBound.right = -80000;
clipregion->rdh.rcBound.bottom = -80000;
for (index=0; index<Clipnumber; index++)
{
if (clipsqe[index].left < clipregion->rdh.rcBound.left)
clipregion->rdh.rcBound.left = clipsqe[index].left;
if (clipsqe[index].right > clipregion->rdh.rcBound.right)
clipregion->rdh.rcBound.right = clipsqe[index].right;
if (clipsqe[index].top < clipregion->rdh.rcBound.top)
clipregion->rdh.rcBound.top = clipsqe[index].top;
if (clipsqe[index].bottom > clipregion->rdh.rcBound.bottom)
clipregion->rdh.rcBound.bottom = clipsqe[index].bottom;
}
if (FAILED(lpDDtempclip->SetClipList(clipregion, 0)))
{
free(clipregion);
return(NULL);
}
if (FAILED(lpDDraw->SetClipper(lpDDtempclip)))
{
free(clipregion);
return(NULL);
}
free(clipregion);
return(lpDDtempclip);
}
问题1:
//定义剪切区
clipregion = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER)+Clipnumber*sizeof(RECT));
memcpy(clipregion->Buffer,clipsqe,sizeof(RECT)*Clipnumber);
clipregion->rdh.dwSize = sizeof(RGNDATAHEADER);
clipregion->rdh.iType = RDH_RECTANGLES;
clipregion->rdh.nCount = Clipnumber;
clipregion->rdh.nRgnSize = Clipnumber*sizeof(RECT);
clipregion->rdh.rcBound.left = 80000;
clipregion->rdh.rcBound.top = 80000;
clipregion->rdh.rcBound.right = -80000;
clipregion->rdh.rcBound.bottom = -80000;
请教:
上面这段话是什么意思啊?
问题2:
for (index=0; index<Clipnumber; index++)
{
if (clipsqe[index].left < clipregion->rdh.rcBound.left)
clipregion->rdh.rcBound.left = clipsqe[index].left;
if (clipsqe[index].right > clipregion->rdh.rcBound.right)
clipregion->rdh.rcBound.right = clipsqe[index].right;
if (clipsqe[index].top < clipregion->rdh.rcBound.top)
clipregion->rdh.rcBound.top = clipsqe[index].top;
if (clipsqe[index].bottom > clipregion->rdh.rcBound.bottom)
clipregion->rdh.rcBound.bottom = clipsqe[index].bottom;
}
请教上面这段话是什么意思?
谢谢各位大大!
[em20] [em20] [em20] [em20] |
|