Results 1 to 2 of 2

Thread: Generic implementation for vector-graphics export of qwt plot spectrograms

  1. #1
    Join Date
    Nov 2006
    Dresden, Germany
    Thanked 10 Times in 9 Posts
    Qt products
    MacOS X Unix/X11 Windows

    Default Generic implementation for vector-graphics export of qwt plot spectrograms

    Hi all,

    for our post-processing needs we want to improve print quality (incl. PDF export) by generating vector-based plots from QwtPlotSpectrogram data. While we can implement this in a custom way, I think there may be a generic way to go about this, that would work for many cases. The idea is to add optional virtual functions that you may implement in your spectrogram implementation and the rendering process would run along these lines:

    1. First request a list/vector of points and triangles that approximate the color maps shape. A convenience function may be provided to automatically generate triangulated data from a rectangular grid. What needs to be generated is a list of points (index and optionally coordinates) and a list of triangles defined via point references. The implementer of this function can effectively control the granularity of the generated triangulation and thus the smoothness of approximating the actual data.
    2. Implement an API that generates values for each point (or alternatively a function that generates x,y coordinates for a point-by-index and then using the value() function from plot spectrogram to get the value). The idea for generating a list of values matching the list of points is just for those implementations of spectrogram plot that render the image themselves and do not bother to implement the value() function.

    With those functions in place, the generic routine could generate vector-based plots using the following algorithm:

    • for each triangle get the corner values
    • compute the projection onto the z-plane with linear gradient vectors
    • compose a Qt-linear gradient using the colors associated to the values
    • paint a filled triangle with this gradient brush

    I tested that with a small example and the generated SVG and PDF files are indeed free of raster-image data.


    a) is there actually a wider interest in such a feature (after all, a generic implementation is quite a bit more work than a hard-coded single-app variant)
    b) @Uwe: what are your thoughts on adding API functions for this purpose to the QwtRasterData or QwtPlotSpectrogram classes?


  2. #2
    Join Date
    Feb 2006
    Munich, Germany
    Thanked 860 Times in 809 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    MacOS X Unix/X11 Windows

    Default Re: Generic implementation for vector-graphics export of qwt plot spectrograms

    That goes into the direction of using a contouring algo, that creates closed polygons instead of lines - what CONREC does. I remember, that I once had such an algo in mind, but never found the time to implement it. Having such an contouring allows to draw filled polygons instead of raster data.

    If you like you can do some research if you can find resources about these type of algos ?


Similar Threads

  1. Vector graphics in Qt4
    By Abayo in forum Newbie
    Replies: 8
    Last Post: 8th August 2013, 12:06
  2. Replies: 1
    Last Post: 17th April 2012, 10:10
  3. Replies: 1
    Last Post: 24th January 2011, 13:57
  4. Painting vector graphics...
    By Muffin in forum Newbie
    Replies: 2
    Last Post: 5th November 2009, 08:54
  5. big vector graphics
    By Colx007 in forum Qt Programming
    Replies: 5
    Last Post: 22nd January 2008, 13:36


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.