Results 1 to 6 of 6

Thread: colors composition

  1. #1
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default colors composition

    I am trying to find a way to composite colors off screen, using Qt4 API. My code just needs to paint a solid rectangle, with on 1 color. The problem is that the color will be computed according to different parameters, and I would prefer to computer the color off screen and then painting it once on screen. instead of using Qt4 API and painting the same place several times.

    Besides computing the color "manually", what are my options?

  2. #2
    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: colors composition

    What do you need to assemble the color from? Do you mean blending? Due to the use of a backing store by Qt, it might be quicker to use Qt API. Otherwise I'd suggest using OpenGL and/or shaders on the graphics card if you can support it.

  3. #3
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: colors composition

    Hi wysota,

    Basically, I have to draw a box using a simple QPainter. The color of the box will be determintaed by several factors.

    What API does Qt4 supplied for color blending, *before* it reaches the QPainter (no need to paint 5 times a 500x10 rectangle if it can be painted once).

  4. #4
    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: colors composition

    It will be painted only once. First four passes will go through the backing store where the final colour is computed and rendered to the framebuffer. So you might say that all compositions are performed offscreen (unless the paint engine doesn't use the backing store). At worst render to QImage (which uses BS) and then render the final image to the final destination.

  5. #5
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: colors composition

    nah... that's lame. sorry, at worst case scenarion I will compute the colors once "manually", but this if really a "too lame way" to acomplish it.

    What if I need to use that color for CSS styles on a button-box or something...?

  6. #6
    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: colors composition

    Sorry, I don't understand your problem, so I can't help you... If you want to compute the colour manually, there are mathematical equasions for that - I think they are even present in composition modes docs in Qt reference, you can take a look at them.

Similar Threads

  1. QTreeView -- Alternating Row Colors Oddity
    By chuckshaw in forum Qt Programming
    Replies: 2
    Last Post: 4th October 2007, 19:41
  2. row colors
    By nategoofs in forum Qt Programming
    Replies: 3
    Last Post: 17th August 2007, 19:16
  3. Interface composition and QObject
    By brcain in forum Qt Programming
    Replies: 9
    Last Post: 20th November 2006, 17:56
  4. Fonts, Colors, and QStyle
    By Jimmy2775 in forum Qt Programming
    Replies: 1
    Last Post: 28th September 2006, 07:26
  5. Qt Designer 4.0.1 Preview Colors
    By jtyler in forum Qt Tools
    Replies: 2
    Last Post: 14th February 2006, 15:47

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.