Results 1 to 8 of 8

Thread: Get Pixel Values

  1. #1
    Join Date
    Jun 2011
    Posts
    22
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default 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..

  2. #2
    Join Date
    Jun 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default 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

  3. #3
    Join Date
    Jun 2011
    Posts
    22
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default 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

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default 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.
    Last edited by Santosh Reddy; 14th June 2011 at 08:41.

  5. #5
    Join Date
    Jun 2011
    Posts
    22
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Get Pixel Values

    thanks Santosh...

    But i could not understand what u say..will u please elaborate so i can understand easily..

  6. #6
    Join Date
    May 2011
    Posts
    120
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default 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.

  7. #7
    Join Date
    Jun 2011
    Posts
    22
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default 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.

  8. #8
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default 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

Similar Threads

  1. pixel to inch or mm
    By lzpmail in forum Qt Programming
    Replies: 3
    Last Post: 18th May 2011, 03:39
  2. Replies: 1
    Last Post: 15th November 2010, 23:46
  3. how can i edit pixel values
    By Askar in forum Qt Programming
    Replies: 1
    Last Post: 4th March 2010, 05:09
  4. How do i display the rgb value of a pixel
    By davidw in forum Qt Programming
    Replies: 2
    Last Post: 18th May 2009, 00:51
  5. QPixmap pixel by pixel ?
    By tommy in forum Qt Programming
    Replies: 19
    Last Post: 3rd December 2007, 23:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.