aboutsummaryrefslogtreecommitdiff
path: root/colormap.h
blob: 806624ac2baaab75e41352bed455c9f842f694c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef COLORMAP_H
#define COLORMAP_H

#include <vector>

#include <QtQuick>
#include <QSGDynamicTexture>

#include <armadillo>

#include "colorscale.h"

class Colormap
    : public QQuickItem
{
    Q_OBJECT
public:
    static const int SAMPLES = 128;

    Colormap(QQuickItem *parent = 0);
    ~Colormap();

signals:
    void colorScaleChanged(const ColorScale &scale) const;

public slots:
    void setColorScale(const ColorScale &scale);

protected:
    QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);

private:
    QSGNode *newSceneGraph();

    QSGDynamicTexture *m_texture;
    bool m_shouldUpdateTexture;
    std::vector<float> m_cmap;
};

#endif // COLORMAP_H