gzxyt 2006-4-13 06:21
请问WinCopyRectangle函数怎么用?
我打算在offscreen上画图,然后复制到一个设置好的窗口上显示。函数如下:
Bounds = SetBound(Bounds,0,91,48,48);//SetBound()是设置Bounds的函数。
Lw = WinCreateWindow(&Bounds,simpleFrame,true,true,&err);
OffLw = WinCreateOffscreenWindow(48,48,screenFormat,&err);
RectangleType r;
WinGetBounds(OffLw,&r);
WinCopyRectangle(OffLw,Lw,&r,0,91,winPaint);
WinSetDrawWindow(Lw);
但是在WinCopyRectangle执行完了,还没有执行WinSetDrawWindow,就会在屏幕上显示画好的图了。为什么呢?
还有就是,WinCopyRectangle不是将offscreen的东西直接拷贝到外部显示窗口的位置上吗?为何当我设置成:
WinCopyRectangle(OffLw,Lw,&r,0,0,winPaint);
时,他会在(0,0)开始显示呢?
难道我需要将offscreen的东西先clip出来,再贴到外部设置好的窗口上么?
希望能够和了解Win系列函数的朋友交流一下。
谢谢大家关注。:F:
ecool 2006-4-13 18:26
Lw = WinCreateWindow(&Bounds,simpleFrame,true,true,&err);
OffLw = WinCreateOffscreenWindow(48,48,screenFormat,&err);
// 设置当前draw window为off screen window
WinSetDrawWindow(OffLw);
// 在off screen中执行画图操作
// ... do something
// 设置当前draw window为一般窗口
WinSetDrawWindow(Lw);
// 复制
WinCopyRectangle(OffLw,Lw,&r,0,91,winPaint);