Results 1 to 4 of 4

Thread: How to add colormap from files?

  1. #1
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question How to add colormap from files?

    Hi,
    Recently,I find that in the example spectrogram,it use QwtLinearColorMap and use the function
    QwtLinearColorMap::addColorStop,but if I want to init the colormap from my file f.e *.map, how can I achieve such effect?
    In *.map,data like this:
    0 0 255
    3 1 252
    5 1 250
    8 2 247
    10 3 245
    13 3 242
    15 4 240
    18 4 237
    20 5 235
    23 6 232
    26 6 230
    28 7 227
    31 8 224
    33 8 222
    36 9 219
    38 10 217
    41 10 214
    43 11 212
    46 11 209
    48 12 207
    51 13 204
    54 13 201
    56 14 199
    59 15 196
    61 15 194
    64 16 191
    66 17 189
    69 17 186
    71 18 184
    74 18 181
    77 19 179
    79 20 176
    ...
    maybe 100 lines in total.
    Thank you.

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

    Default Re: How to add colormap from files?

    I guess this is list of rgb values. Assuming you have 100 colors simply build a color map using the first and the last color. Then add color stops with a distance of 0.01 according to your list.

    Uwe

  3. #3
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add colormap from files?

    Quote Originally Posted by Uwe View Post
    I guess this is list of rgb values. Assuming you have 100 colors simply build a color map using the first and the last color. Then add color stops with a distance of 0.01 according to your list.

    Uwe
    It's a list of rgb values,as you suggested, it's really a way to solve such problem,but I'm afriad that I couldn't agree with you,it 's not a good one. I just want to use a conveniet way to change colormap,such as load from files, by the way,many files f.e *.map,has offer perfect colormap,what I should do is just apply them.Is there any other way to solve this problem?
    Before post it,I have read the QwtColorMap document,but I cann't find any good idea to load colormap except QwtLinearColorMap addColorStop.
    Thank you.

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

    Default Re: How to add colormap from files?

    Loading your rgb values from file and passing them to a QwtLinearColorMap should be a loop with about 10 lines of code. It's probably written faster than what I needed to write this answer.

    Note, that Qwt is a framework for software developers on a different level than a tool like gnuplot. If you don't want to write code better look for an application f.e like QtiPlot.

    Uwe

Similar Threads

  1. Replies: 9
    Last Post: 28th April 2010, 10:18
  2. Replies: 12
    Last Post: 17th June 2009, 06:34
  3. Replies: 1
    Last Post: 26th October 2008, 19:39
  4. visual studio project files - adding extra files
    By luf in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2008, 22:05
  5. how to save sequences of text files and sound files
    By nagpalma in forum Qt Programming
    Replies: 8
    Last Post: 3rd July 2007, 01:06

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.