digiKam
glviewertexture.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2007-02-11
7  * Description : a tool to show image using an OpenGL interface.
8  *
9  * Copyright (C) 2007-2008 by Markus Leuthold <kusi at forum dot titlis dot org>
10  * Copyright (C) 2008-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_GLVIEWER_PLUGIN_GLVIEWER_TEXTURE_H
25 #define DIGIKAM_GLVIEWER_PLUGIN_GLVIEWER_TEXTURE_H
26 
27 // Qt includes
28 
29 #include <QOpenGLTexture>
30 #include <QOpenGLWidget>
31 #include <QImage>
32 #include <QString>
33 
34 // Local includes
35 
36 #include "dinfointerface.h"
37 
38 using namespace Digikam;
39 
41 {
42 
43 class GLViewerTexture : public QOpenGLTexture
44 {
45 
46 public:
47 
48  explicit GLViewerTexture(DInfoInterface* const iface);
49  ~GLViewerTexture();
50 
51  bool load(const QString& fn, const QSize& size);
52  bool load(const QImage& im);
53  bool loadFullSize();
54 
55  GLfloat vertex_bottom() const;
56  GLfloat vertex_top() const;
57  GLfloat vertex_left() const;
58  GLfloat vertex_right() const;
59 
60  void setViewport(int w, int h);
61  void zoom(float delta, const QPoint& mousepos);
62  void reset(bool resetFullImage = false);
63  void move(const QPoint& diff);
64  bool setNewSize(QSize size);
65  void rotate();
66  void zoomToOriginal();
67 
68 private:
69 
70  bool loadInternal();
71  void calcVertex();
72 
73 private:
74 
75  // Disable
76  GLViewerTexture(const GLViewerTexture&) = delete;
77 
78 private:
79 
80  class Private;
81  Private* const d;
82 };
83 
84 } // namespace DigikamGenericGLViewerPlugin
85 
86 #endif // DIGIKAM_GLVIEWER_PLUGIN_GLVIEWER_TEXTURE_H
Definition: glviewertexture.h:44
Definition: dinfointerface.h:56
Definition: glviewerglobal.h:35
Definition: datefolderview.cpp:43