File indexing completed on 2024-04-28 03:44:02

0001 /*
0002     SPDX-FileCopyrightText: 2023 Hy Murveit <hy@murveit.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #pragma once
0007 
0008 #include "ui_fitsstretchui.h"
0009 #include "stretch.h"
0010 
0011 #include <QWidget>
0012 
0013 class FITSView;
0014 
0015 class FITSStretchUI : public QWidget, public Ui::FITSStretchUI
0016 {
0017         Q_OBJECT
0018 
0019     public:
0020         FITSStretchUI(const QSharedPointer<FITSView> &view, QWidget * parent = nullptr);
0021 
0022         void generateHistogram();
0023         void setStretchValues(double shadows, double midtones, double highlights);
0024 
0025     private:
0026         void setupButtons();
0027         void setupHistoPlot();
0028         void setupHistoSlider();
0029         void setStretchUIValues(const StretchParams1Channel &params);
0030         void setupConnections();
0031         void onHistoDoubleClick(QMouseEvent *event);
0032         void onHistoMouseMove(QMouseEvent *event);
0033 
0034         QCPItemLine * setCursor(int position, const QPen &pen);
0035         void setCursors(const StretchParams &params);
0036         void removeCursors();
0037 
0038         QSharedPointer<FITSView> m_View;
0039         QCPItemLine *minCursor = nullptr;
0040         QCPItemLine *maxCursor = nullptr;
0041         QVector<QCPItemLine*> pixelCursors;
0042 };
0043