PDA

View Full Version : RGB values greater than 8bit & QColor?



smacchia
20th March 2007, 14:17
How can I create a QColor object with RGB values that are greater than 8 bit? I am converting a legacy app that uses 16 bit rgb values.

TIA,
Susan

high_flyer
20th March 2007, 14:31
Which format are you using? 565?
AFIK only qith Qtopia you can work natively with 16bpp in Qt.
Depends on the requirements of your project, I guess it is best if you just norm all 3 channels to 8bits pers channel for displaying.
Or do you mean that you have more then 8 bits per channel (i.e more then 24bpp)??

smacchia
20th March 2007, 14:51
I'm not sure what you mean by format. I'm working with RGB values that are 16 bit each coming from a legacy Motif app. I'm trying to convert those to QColor so that I can use them to paint. When I look at the Qt docs, I can't find anything about specifying RGB with values greater than 255. I am working with Qt4.2.

TIA,
Susan

high_flyer
20th March 2007, 16:19
RGB comes in various formats.
565 is a common 16bit RGB format 5red 6green 5blue.
Are you sure you are working with values that are grater than 255 per channel?
If you do, there is no need to convert the color for displaying, since the display hardware (grphic card, screen and probably the windowing system as well) can't show more than 8bits per channel anyhow.
You will have to norm your values to 255 per channel in order to display them.

wysota
20th March 2007, 19:44
Does Motif really allow 48bit colours? I would never expect it to...

smacchia
21st March 2007, 12:28
Does Motif really allow 48bit colours? I would never expect it to...
It certainly supports 16 bit colors. I don't know about 48 bit. And it really isn't Motif per se but the graphics drivers and color map support in X (given the graphics card). We need 16 bit color support for our app because 8 bit doesn't have enough colors and we are drawing many wave forms in many colors.

From what I can tell from the Qt Assistant, QColor is only capable of handling 8bit colors and this isn't sufficient for our app. I am sure that other folks have needed to use colors > 8 bit, so Qt must have a solution, only I can't find one...

Thanks in advance for any help/pointers.
--Susan

smacchia
21st March 2007, 12:32
RGB comes in various formats.
565 is a common 16bit RGB format 5red 6green 5blue.
there is no need to convert the color for displaying, since the display hardware (grphic card, screen and probably the windowing system as well) can't show more than 8bits per channel anyhow.
You will have to norm your values to 255 per channel in order to display them.
As I said in my previous post, we need more colors thatn 8bit can support. The graphics hardware we use is capable of supporting 16 bit colors, as is X11 (I'm talking Linux here). Our app is drawing wave forms among many other things that colors are needed for. If Qt can support colors greater than 8bit, than I have a serious show stopper for using Qt to do the graphics rendering.

wysota
21st March 2007, 13:00
It certainly supports 16 bit colors. I don't know about 48 bit.
Are we talking 16bit colours or "16bit per gun" colours (which gives 3x16b=48b)?


And it really isn't Motif per se but the graphics drivers and color map support in X (given the graphics card). We need 16 bit color support for our app because 8 bit doesn't have enough colors and we are drawing many wave forms in many colors.


From what I can tell from the Qt Assistant, QColor is only capable of handling 8bit colors and this isn't sufficient for our app. I am sure that other folks have needed to use colors > 8 bit, so Qt must have a solution, only I can't find one...

Qt4 operates on 32bit colours (24b hue + 8b alpha), so if you want to reduce the colourspace it should be just a matter of setting an appropriate colour map (or not doing anything at all letting X handle the transformation).

smacchia
21st March 2007, 13:20
Are we talking 16bit colours or "16bit per gun" colours (which gives 3x16b=48b)?





Qt4 operates on 32bit colours (24b hue + 8b alpha), so if you want to reduce the colourspace it should be just a matter of setting an appropriate colour map (or not doing anything at all letting X handle the transformation).

16 bit per gun. So yes 48b. I am not a graphics or color expert, but am working on the Qt prototype for our product which is legacy Motif. The colors in the Motif app are specified with rgb values that are 16 bits each (hence 48b). I need to convert these colors to a Qt equivlent. How can I do this?

-- Sue

smacchia
21st March 2007, 13:56
Thanks for all the feedback/help. I just talked to my graphics guru and he said that I need to transform the 16 bit values to 8 bit (using some standard calculation). So he's going to help with that. As I said, I am not a graphics/color expert, so please excuse my lack of knowledge.

Thanks,
Susan

high_flyer
21st March 2007, 14:07
The graphics hardware we use is capable of supporting 16 bit colors, as is X11 (I'm talking Linux here).
Hmm.. I would be supprised if what you wrote here is true.
Could you post your xorg.config file?
I never heard of a display system (I am talking normal PC's here, with linux as you said) that supports more then 32 bit colors, or more than 8bit per channel.

I just talked to my graphics guru and he said that I need to transform the 16 bit values to 8 bit (using some standard calculation).
Yes, that is what I meant when I said you will have to norm the values.

smacchia
21st March 2007, 14:40
I think you right and its my inexperience with graphics and colors. :o

Thanks for some pointers - I learned something today :D