[Qt-interest] Can I draw Qt objects directly to Win32 DC (Device Context)?
Anders Bakken
anders.bakken at myriadgroup.com
Fri May 28 17:22:17 CEST 2010
On Fri, May 28, 2010 at 06:36:15AM +0100, Long Cheng wrote:
> I can draw Qt objects to an QImage and then draw the image to HDC or
> CDC. This may hurt our application's performance. It would be great if
> I can draw Qt objects directly to Win32 HDC or MFC CDC. I expect that
> there is a class, say QWin32Image for clear, then I can use it in this
> way:
>
> QWin32Image image(hdc, 100, 100, Format_ARGB32_Premultiplied);
> QPainter painter(&image);
> painter.drawText(....);
>
> Is it possible for my thought? Or is there a better way to do that?
>
> Thanks,
> Long
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
Presumably there's an API that lets you construct an image of some sort
from a ARGB buffer of pixels.
If so you could do something this.
NativeWindowsImage img;
QImage foo(...);
QPainter p(&foo);
p.draw.*;
NativeWindowsImage temp;
temp.initFrom(foo.bits(), foo.width(), foo.height());
DrawImageOnImage(img, temp);
--
Anders Bakken
This message, including attachments, is intended solely for the addressee indicated in this message and is strictly confidential or otherwise privileged. If you are not the intended recipient (or responsible for delivery of the message to such person) : - (1) please immediately (i) notify the sender by reply email and (ii) delete this message and attachments, - (2) any use, copy or dissemination of this transmission is strictly prohibited. If you or your employer does not consent to Internet email messages of this kind, please advise Myriad Group AG by reply e-mail immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by Myriad Group AG unless otherwise indicated by an authorized representative independent of this message.
More information about the Qt-interest-old
mailing list