Qt applcation Scribble- accessing pixel location

时间:2016-04-15 15:02:00

标签: c++ qt

I am working on this Qt app called scribble. Below is the link

http://doc.qt.io/qt-4.8/qt-widgets-scribble-example.html

I am new to Qt. I want to store the pixel locations of the scribbles(drawn using my mouse pointer) that I draw as [i],[j] values (2d values) and pass them to another function. Where can I access the pixel values ?

1 个答案:

答案 0 :(得分:1)

您需要参考QImage image;变量来读取该涂鸦示例的像素数据。因此,如果您有像素坐标[i][j],请使用pixel()方法:

QRgb rgb = image.pixel(i, j);