[Qt-interest] wrong colors with qrgb888

Albert Graells Rovira txandi at gmail.com
Wed Jul 28 18:11:16 CEST 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100728/a4e0866e/attachment.html 


More information about the Qt-interest-old mailing list