[Qt-interest] XOR two QImages
Samuel Rødal
samuel.rodal at nokia.com
Thu Aug 12 09:53:19 CEST 2010
On 08/11/2010 09:04 PM, ext Michael S wrote:
> Thanks Samuel,
>
> It worked as expected. Now I am trying to do the same with text, i.e. draw text on top of QImage
>
> QImage bgImg ("bg.png");
> QImage fgImg ("fg.JPG");
> QPainter painter (&bgImg);
> painter.setCompositionMode(QPainter::CompositionMode_Xor);
> painter.drawImage(0, 0, fgImg);
> bgImg.save("result.bmp");
> QFont font ("Verdana", 24);
> painter.setFont(font);
> QString sText ("HELLO WORLD");
> painter.drawText (200,200, sText);
> bgImg.save("result.bmp");
>
> But it doesn't seem to have the same affect on text. Are there any QPainter or QFont settings I'd need to adjust?
>
> Thanks again,
> Michal
Text is rendered with antialiasing which is incompatible with the XOR
raster op. What effect is it you want to achieve by using XOR to render
text?
--
Samuel
More information about the Qt-interest-old
mailing list