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

Jason H scorp1us at yahoo.com
Wed Apr 7 03:18:15 CEST 2010


Correction, fill the set bits as transparent, then use a QGraphicsRectItem UNDER (z order) under it, and just change the rectangle color below it) You can possibly use a QGraphicsItemGroup. to ease management...




________________________________
From: Jason H <scorp1us at yahoo.com>
To: Glenn Hughes <ghughes01238 at gmail.com>; qt-interest at trolltech.com
Sent: Tue, April 6, 2010 9:14:39 PM
Subject: Re: [Qt-interest] drawImage with monochrome QImage with color transfer (vs QGraphicsScene)


QGraphicsPixmapItem.
what you're really doing is using a the bits as a mask, so fill() (not fillRect()) a pixmap with transparent color and set the set bits to your color.






________________________________
From: Glenn Hughes <ghughes01238 at gmail.com>
To: qt-interest at trolltech.com
Sent: Tue, April 6, 2010 9:06:18 PM
Subject: [Qt-interest] drawImage with monochrome QImage with color transfer (vs QGraphicsScene)

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/a8b2aa3f/attachment.html 


More information about the Qt-interest-old mailing list