[Qt-interest] wrong colors with qrgb888

ghal_maraz at gmx.de ghal_maraz at gmx.de
Wed Jul 28 18:54:31 CEST 2010


thanks for your reply.

Yes, you are right with the stuff of the alpha blending. But that was not why i had problems with this code.
rawValue returns data[0] data[1] data[2] and the cast-operator data[2] data[1] data[0] and i dont know
why the order of the colors should be a different. furthermore i tried to run my display with rgb565 (drivers
in 16bit mode and support for pixel depth 16 in qt) and the colors were right. the class qrgb565 returns
always the colors in the same order.
and i checked the configuration of the qwsserver and the kernel drivers for the displays: all configured for
rgb.
Does anybody know how qt uses the qrgb888-class? does it call rawValue() or the cast-operator?

Am 28.07.2010 18:11, schrieb Albert Graells Rovira:
> Hi,
>
> qRgb does a little bit more than rawValue(), as it uses 32 bits: 24 for the values of R, G and B, and an extra byte for the Alpha value (transparency), which is by default 255 (completely opaque color).
>
> The problem with the R and B channels being swapped on your display happens because it assumes a BGR codification of the color (and not RGB).
>
>
> 2010/7/28 <ghal_maraz at gmx.de>
>
>     hi,
>
>     i am using qt embedded(4.6.3) on a develpoment board with arm9 and 24bit display.
>     my problem is that the colors are wrong. the red and blue part is mixed.
>     to find the problem i searched in the source and found the class qrgb888 in src/gui/painting/qdrawhelper_p.h. this class returns its color value via two methods. but these methods return different results. here the methods i mean:
>
>
>     quint32 qrgb888::rawValue() const
>     {
>         return (data[2] << 16) | (data[1] << 8) | data[0];
>     }
>
>     qrgb888::operator quint32() const
>     {
>         return qRgb(data[0], data[1], data[2]);
>     }
>
>     Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)// set RGB value
>     { return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
>
>
>     is this a bug and could be the reason for my problems?
>      
>     best regards
>     ghal maraz
>
>
>
>     -- 
>     GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.
>     Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
>
>     _______________________________________________
>     Qt-interest mailing list
>     Qt-interest at trolltech.com
>     http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
>
> -- 
> albert

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



More information about the Qt-interest-old mailing list