QWT, how to Plot RGB values (show image in plot as rgb points)?

0

Using QWT, I want to plot an image. Each point of the image is set as argb value. For example:

  • first line, first pixel is red = 0xFFFF0000;
  • first line, second pixel is green = 0xFF00FF00;
  • second line, first pixel is blue = 0xFF0000FF;
  • x line, y pixel is a combination of argb = 0xFF13F150;

I tried the following:

  • attaching QwtPlotSpectrogram to QwtPlot
  • using PlotData with:

    setInterval( Qt::ZAxis, QwtInterval( 0, 0xFFFFFFFF ) );
    

but I expected to find a Color Map class (like QwtLinearColorMap) that handles rgb values; Should I create it by myself inheriting from QwtColorMap? How? Am I on the wrong path?

My current solution (improvements are welcome):

Implemented Color Map like this:

class RgbColorMap: public QwtColorMap {
    virtual QRgb rgb( const QwtInterval &interval, double alpha_rgb ) const {
        return alpha_rgb;
    }

    virtual unsigned char colorIndex( const QwtInterval &interval, double value ) const {
        return 0;
    }
};
qwt
asked on Stack Overflow Apr 8, 2019 by Nicola Vacca • edited Apr 8, 2019 by Nicola Vacca

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0