[Qt-interest] How to render text on Image with different color???
Robert Hairgrove
evorgriahr at hispeed.ch
Tue May 4 12:42:12 CEST 2010
trinathpujari wrote:
> Hi All,
>
> I have text drawn on QImage. Now i want to change back ground
> color as black and text as some other color(selected).I am checking each
> pixel color and updating the pixel color. But text is becoming distorted.
> Alternative to this i did invert pixel at that time text is coming
> properly but Back ground is different(Not black which i wanted).
> Please help me to resolve this.
Wouldn't it be easier (and possibly faster) to just erase the entire
background and redraw the text?
The default behaviour for drawing text with QPainter is with
antialiasing on. Antialiasing blends the edges of the text with the
background color to provide a smoother perception (i.e. less jagged
edges). If you need to change the image pixel by pixel, you will
probably want to turn this off by setting the appropriate property of
the QFont object before drawing the text (see documentation for the
QPainter class for details).
More information about the Qt-interest-old
mailing list