[Qt-interest] drawImage with monochrome QImage with color transfer (vs QGraphicsScene)

Glenn Hughes ghughes01238 at gmail.com
Wed Apr 7 03:06:18 CEST 2010


Hey,

I'm transitioning some code from the Mac, and I'm trying to figure out how
to get a particular graphical effect.

Currently we make our own Bitmap, draw directly into the memory for speed,
then use CopyBits to move the Bitmap memory on screen.
In the process, the foreground color is used to colorize the one-bit image.
So, while the image we make in memory is black and white, it can be any
color we wish by the time the user sees it.
What's the best way to do something like this with QPainter?
It seems like using a QImage and then getting at the raw buffer with bits()
can replicate the first part of what we do...
but I can't figure out how to colorize it with QPainter::drawImage.
Any ideas?

Taking a step back, is there a better way to accomplish this sort of thing?
The data we're drawing is pretty random. If I make paths from it, they're
going to be quite complicated. This is something that needs to be as high
performance as possible because we have to draw a lot of this stuff in a
scrolling pane.  (Imagine large numbers of EKG paths that may be many hours
in duration that need to quickly scroll.)

Would I be better off adding paths to a QGraphicsScene?

Thanks and best wishes
Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100406/e95f5221/attachment.html 


More information about the Qt-interest-old mailing list