[email protected] wrote:
> Hi,
> 
>> Where are you drawing the image and on which platform. There 
>> is no dithering happening QPainter nor QImage for 32 bit color 
>> depths, so the only places where dithering can happen is if 
>> you are running on a 16-bit display or if the original image 
>> was already dithered. Since you say the dithering goes away 
>> with larger pen widths (more blurried image) it sounds like 
>> the source is the problem.
>> -
>> Gunnar
> 
> Actually it was the alpha channel that I had not properly used and
> thanks yet again to Gunnar for helping me to solve this problem.
> The following code got it working ...
> 
>         QImage img1 = img.alphaChannel();
>         for (int i = 0; i < w(); i++) {
>             for (int j = 0; j < h(); j++) {
>               // do the pixel manipulation here
>             }
>         }
>         img.setAlphaChannel(img1);
>         return img;

This is very ineffictient. The setAlphaChannel and alphaChannel should 
not be used when you anyway access all the pixels directly. If you do:

QColor qcol = new QColor(col);
qcol.setHsvF(0.0, 1.0, 0.5, 1.0);
img.setPixel(i, j, (qcol.argb() & 0x00ffffff) | (col & 0xff000000));

in the innerloop instead, you just copy over the alpha channel when you 
work on the pixel anyway. Much faster ;)

-
Gunnar
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to