-
Get Pixel Values
Hi..
I have been facing problem with getting pixel values..
Suppose I have entered a text in editbox and this text are drawn on QPainter(DC).Now i want to get pixel values of that text(Co-ordinates) so i can draw that text with moveTo and lineTo with another QPainter object.
Waiting for quick reply..
Thanks..
-
Re: Get Pixel Values
Quick reply:
Draw on a QImage and use:
QRgb pixel ( const QPoint & position ) const
QRgb pixel ( int x, int y ) const
-
Re: Get Pixel Values
Thanks for quick reply..
Actually i want position of pixels drawn on QPainter in other terms each and every point of text drawn..
Suppose i have drawn text "abc" from some starting point(0,0) on QPainter then i want co-ordinates of each and every points.
Best regards..
Amit
-
Re: Get Pixel Values
Your post not clear
Use the text in the editbox and use QPainter to draw text at required location, save the location if wish to. What is that you are look for?
Added after 12 minutes:
You need to use QPainterPath, and then use bonding rectangle of the path, get all the sub paths in it, and prepare a list of pointer which are in the intersection of both the bonding rectangle and the sub paths.
Why do you need all the points on the text drawn? There should be a simpler way by avoid this.
-
Re: Get Pixel Values
thanks Santosh...
But i could not understand what u say..will u please elaborate so i can understand easily..
-
Re: Get Pixel Values
Are you want to x and y cordinates of text drawn? If yes than you can use any of the mouseEvent to get cordinates.
-
Re: Get Pixel Values
I know i can get x and y coordinates from mouseEvent but i want all the coordinates of that text that are drawn on the QPaint so i can use that in another place to draw the same text.
-
Re: Get Pixel Values
You can use QPainterPath to get the all the region in the path, try reading QPainterPath, look at how to get sub-paths of the text drawn