Results 1 to 3 of 3

Thread: Coloring speccific values in a spectrogram

  1. #1

    Default Coloring speccific values in a spectrogram

    Hello,
    I have the following situation: I have a spectrogram for which I use a color map with color stops. It works fine, but I want to use the color grey for 0 values returned by the value function that needs to be overloaded. The interval in the plot widget may or may not include the zero, but I want all pixels in the spectrogram, where 0 was returned, to be grey. Color stops work only in the interval range, but even if they didn't I need only one value to have a color, not a range of values(even a narrow one).
    How can I accomplish this?
    (attached is a screenshot that shows what I want to do)

    Thank you
    Attached Images Attached Images

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Coloring speccific values in a spectrogram

    You can overload QwtLinearColorMap::rgb() and add some special handling for 0.0 before calling the base class.

    But note that QwtLinearColorMap::rgb() already has this code made for gaps in a spectrogram:

    Qt Code:
    1. if ( qIsNaN(value) )
    2. return qRgba(0, 0, 0, 0);
    To copy to clipboard, switch view to plain text mode 
    So when using NaN instad of 0.0 you would have transparent pixels and you would see the background color of the canvas ( could be gray if you want to ).

    Uwe

  3. #3

    Default Re: Coloring speccific values in a spectrogram

    Excellent! Thank you very much, looks very good.

Similar Threads

  1. coloring the QString
    By riarioriu3 in forum Newbie
    Replies: 3
    Last Post: 27th September 2012, 23:20
  2. QLinearGradient Coloring
    By WSQtProgrammer in forum Qt Programming
    Replies: 1
    Last Post: 5th July 2012, 17:59
  3. Coloring Circle
    By Jeneo W. in forum Qt Programming
    Replies: 1
    Last Post: 11th October 2010, 04:39
  4. Replies: 9
    Last Post: 16th March 2010, 09:30
  5. Replies: 1
    Last Post: 25th July 2008, 08:38

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.