请教:下面这段关于剪切板的程序,我看不懂,请各位大大帮我!

WAWJX 2006-02-24 03:06:28
//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;
}

请教上面这段话是什么意思?

谢谢各位大大!
...全文
68 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Alan S1 2006-04-28
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/4594/4594663.xml?temp=.2132532

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧