On 09/22/2012 09:25 PM, Mark wrote: > On Sat, Sep 22, 2012 at 9:15 PM, Josiah Bryan <josiahbr...@gmail.com> wrote: >> Subclass QWidget::paintEvent(QPaintEvent*) >> (http://doc.qt.digia.com/4.6/qwidget.html#paintEvent) and do your own >> painting of the widget. See the Analog Clock example >> (http://doc.qt.digia.com/4.7-snapshot/widgets-analogclock.html) for an >> example on how to draw the contents of the widget. >> >> If you're wanting to do per-pixel work - the easiest (only?) way is via a >> QImage - there is no direct per pixel access to video memory. The closest >> thing you'll get to direct-pixel access of video memory is to use a >> QGLWidget and implement pixel shaders. >> >> On Sat, Sep 22, 2012 at 3:00 PM, Mark <mark...@gmail.com> wrote: >>> Hi, >>> >>> I know one can manipulate pixel data in a QImage using the bits() >>> function, but how can i do the same for a QWidget? >>> I want to play with a high performance line drawing algorithm [1] so i >>> guess it's not very optimal to do the following: >>> - draw in a QImage >>> - put that image in the qwidget >>> - further drawing in the QImage >>> - put it on the QWidget again >>> - ... and so on ... >>> >>> In this case i'm guessing that the QImage mapping to a QWidget would >>> be the most costly one hence i'd like to prevent that altogether and >>> "just" manipulate the QWidget pixel data directly. >>> So how do i do that? >>> >>> Cheers, >>> Mark >>> >>> [1] http://free.pages.at/easyfilter/bresenham.html >>> _______________________________________________ >>> Interest mailing list >>> Interest@qt-project.org >>> http://lists.qt-project.org/mailman/listinfo/interest > Thank you for your reply :) > > Though that is sadly not going to work. Remember, i want to test out > another line drawing algorithm.. not the one from QPainter. > QGLWidget and pixel shaders is also not an option. I first want to do > this in software, not hardware/opengl. > > I could really use some way to get the widget pixel data... > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest
You draw to QImage in QWidget::paintEvent(QPaintEvent*) and blit that to widget. -Harri _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest