• 8749阅读
  • 6回复

请教QT中怎样在一个图片上画点 [复制链接]

上一主题 下一主题
离线gpj87
 
只看楼主 倒序阅读 楼主  发表于: 2008-08-06
— 本帖被 XChinux 执行加亮操作(2008-08-06) —
小弟已经有一个程序可以把图片显示出来,想在图片上画点,不知改如何实现?希望达人们说的详细点,小弟是新手,谢谢达人们了!
离线mecland
只看该作者 1楼 发表于: 2008-08-06
setPixel (x, y, QRgb(r,g,b))即可
离线gpj87
只看该作者 2楼 发表于: 2008-08-06
?不好意思,小弟没看懂,可以解释一下这个函数吗?
离线mecland
只看该作者 3楼 发表于: 2008-08-06
void setPixel ( const QPoint & position, uint index_or_rgb )

Sets the pixel index or color at the given position to index_or_rgb.

If the image's format is either monochrome or 8-bit, the given index_or_rgb value must be an index in the image's color table, otherwise the parameter must be a QRgb value.

If position is not a valid coordinate pair in the image, or if index_or_rgb >= numColors() in the case of monochrome and 8-bit images, the result is undefined.

See also pixel() and Pixel Manipulation.
离线gpj87
只看该作者 4楼 发表于: 2008-08-06
那个......小弟很菜,英文只看了个一知半解,我想是在图上动态的画点,就是“点哪画哪”那种,不知上面的函数是否能实现?
离线jssx
只看该作者 5楼 发表于: 2008-08-06
既然要动态,你要先得到点的位置,然后再调用1楼的函数。
离线duduqq

只看该作者 6楼 发表于: 2008-08-09
都在要paintEvent()函数里面实现吧
快速回复
限100 字节
 
上一个 下一个