Results 1 to 2 of 2

Thread: How to get pixel color from QPainter ??

  1. #1
    Join Date
    Aug 2008
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to get pixel color from QPainter ??

    Hi,
    I need to get the color of the pixel that I drew with QPainter. I create a QWidget and wrote my own code for the paintEvent function after setting the widget to opaque mode using Qt::WA_OpaquePaintEvent. Now as I draw more and more pixel I need to get the color of one of the pixels that I drew earlier. Is there any function for it or is there any method by which I can do it ???

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to get pixel color from QPainter ??

    How about drawing on a QImage instead? QImage provides pixel level access. You can draw the image on the widget with QPainter::drawImage().
    J-P Nurmi

Similar Threads

  1. QPixmap pixel by pixel ?
    By tommy in forum Qt Programming
    Replies: 19
    Last Post: 3rd December 2007, 23:52
  2. Replies: 7
    Last Post: 20th March 2006, 21:03

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.