Add thumbnails

This commit is contained in:
2022-04-18 07:16:46 +02:00
parent 2c95364fc4
commit 4e6230eef2
14 changed files with 347 additions and 39 deletions
+14 -1
View File
@@ -4,13 +4,14 @@
#include <memory>
#include <QObject>
#include <QOpenGLWidget>
#include <QOpenGLFunctions_3_2_Core>
#include <QOpenGLFunctions_3_3_Core>
#include <QOpenGLShaderProgram>
#include <QOpenGLBuffer>
#include <QOpenGLTexture>
#include <QOpenGLVertexArrayObject>
#include <QScrollBar>
#include "rawimage.h"
#include "imageringlist.h"
typedef enum
{
@@ -25,11 +26,16 @@ class ImageWidget : public QOpenGLWidget
{
Q_OBJECT
QOpenGLFunctions *f;
QOpenGLFunctions_3_3_Core *f3;
std::unique_ptr<QOpenGLShaderProgram> m_program;
std::unique_ptr<QOpenGLShaderProgram> m_thumbnailProgram;
std::unique_ptr<QOpenGLBuffer> m_buffer;
std::unique_ptr<QOpenGLBuffer> m_bufferSizes;
std::unique_ptr<QOpenGLTexture> m_image;
std::unique_ptr<QOpenGLVertexArrayObject> m_vao;
std::unique_ptr<QOpenGLVertexArrayObject> m_vaoThumb;
std::unique_ptr<QOpenGLPixelTransferOptions> m_transferOptions;
std::unique_ptr<QOpenGLTexture> m_thumbnailTexture;
int m_width, m_height;
int m_imgWidth, m_imgHeight;
float m_low;
@@ -42,6 +48,8 @@ class ImageWidget : public QOpenGLWidget
bool m_bwImg;
bool m_invert;
bool m_superpixel;
bool m_showThumbnails;
int m_thumbnailCount;
public:
explicit ImageWidget(QWidget *parent = nullptr);
~ImageWidget();
@@ -49,12 +57,15 @@ public:
void setImage(const QPixmap &pixmap);
void setScale(float scale);
void blockRepaint(bool block);
void allocateThumbnails(int count);
public slots:
void setMTFParams(float low, float mid, float high);
void setOffset(int dx, int dy);
void superPixel(bool enable);
void invert(bool enable);
QImage renderToImage();
void thumbnailLoaded(const Image *image);
void showThumbnail(bool enable);
protected:
void paintGL();
void resizeGL(int w, int h);
@@ -75,12 +86,14 @@ class ImageScrollAreaGL : public QWidget
QPoint m_lastPos;
float m_scale;
bool m_bestFit;
int m_thumbCount;
public:
explicit ImageScrollAreaGL(QWidget *parent = nullptr);
~ImageScrollAreaGL();
void setImage(RawImage *image);
void setImage(const QPixmap &pixmap);
ImageWidget* imageWidget();
void setThumbnails(int count);
protected:
void updateScrollbars(bool zoom = false);
void resizeEvent(QResizeEvent *event);