Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5491038
  • 博文数量: 922
  • 博客积分: 19333
  • 博客等级: 上将
  • 技术积分: 11226
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-27 14:33
文章分类

全部博文(922)

文章存档

2023年(1)

2020年(2)

2019年(1)

2017年(1)

2016年(3)

2015年(10)

2014年(17)

2013年(49)

2012年(291)

2011年(266)

2010年(95)

2009年(54)

2008年(132)

分类:

2010-05-18 21:36:07

关于blit的理解(ok):
void QScreen::blit ( const QImage & image, const QPoint & topLeft, const QRegion & region )   [virtual]
官方文档:
Copies the given region in the given image to the point specified by topLeft using device coordinates.
意思是把image中的region(矩形列表)区域内容,拷贝到设备坐标中的点topLeft上面。
但是,通过打印代码的log,发现,这样理解容易有误,
有一个例子如下:
在blit中,
const QVector rects = region.rects();                                       
for (int i = 0; i < rects.size(); ++i) {                                           
    painter.drawImage( rects.at(i), image, QRect(rects.at(i).topLeft()-topLeft, rect
    s.at(i).size()) );                                                                         
}    
这里,意思是把image中的所有region块(rects[i]),绘制到设备的rects[i]上面。
rects[i]的左上角坐标是相对于设备的,
topLeft是image相对于设备的左上角,
根据函数drawImage的意思,需要把rects[i]转化为相对于image的坐标,所以要减去topLeft。
综上所述,image包含了region中的许多或者一个矩形块,topLeft是image的左上角相对于设备的坐标。目前的理解就是这样。
另外,image的image.rect()的左上角永远是0,0。因为image本身就没有rect的意义。
阅读(4954) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~