Results 1 to 12 of 12

Thread: RGB values greater than 8bit & QColor?

  1. #1
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question RGB values greater than 8bit & QColor?

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: RGB values greater than 8bit & QColor?

    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)??
    Last edited by high_flyer; 20th March 2007 at 14:41.

  3. #3
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: RGB values greater than 8bit & QColor?

    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

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: RGB values greater than 8bit & QColor?

    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.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: RGB values greater than 8bit & QColor?

    Does Motif really allow 48bit colours? I would never expect it to...

  6. #6
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: RGB values greater than 8bit & QColor?

    Quote Originally Posted by wysota View Post
    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

  7. #7
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: RGB values greater than 8bit & QColor?

    Quote Originally Posted by high_flyer View Post
    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.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: RGB values greater than 8bit & QColor?

    Quote Originally Posted by smacchia View Post
    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).

  9. #9
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: RGB values greater than 8bit & QColor?

    Quote Originally Posted by wysota View Post
    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

  10. #10
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: RGB values greater than 8bit & QColor?

    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

  11. #11
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: RGB values greater than 8bit & QColor?

    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.

  12. The following user says thank you to high_flyer for this useful post:

    smacchia (21st March 2007)

  13. #12
    Join Date
    Feb 2007
    Posts
    73
    Thanks
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: RGB values greater than 8bit & QColor?

    I think you right and its my inexperience with graphics and colors.

    Thanks for some pointers - I learned something today

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.