]> git.sesse.net Git - kdenlive/blob - src/widgets/videoglwidget.h
Various changes for getting an OpenGL context (almost) everywhere it is needed.
[kdenlive] / src / widgets / videoglwidget.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *               2014 by Jean-Nicolas Artaud (jeannicolasartaud@gmail.com) *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
19  ***************************************************************************/
20
21 #ifndef VIDEOGLWIDGET_H
22 #define VIDEOGLWIDGET_H
23
24 #include <QGLWidget>
25
26 class VideoGLWidget : public QGLWidget
27 {
28     Q_OBJECT
29
30 public:
31     explicit VideoGLWidget(QWidget *parent = 0, QGLWidget *share = 0);
32     ~VideoGLWidget();
33     void activateMonitor();
34     QSize minimumSizeHint() const;
35     QSize sizeHint() const;
36     void setImageAspectRatio(double ratio);
37     void setBackgroundColor(const QColor &color) {
38         m_backgroundColor = color;
39     }
40
41 public slots:
42     void showImage(const QImage &image);
43     void showImage(GLuint);
44
45 protected:
46     void initializeGL();
47     void resizeGL(int width, int height);
48     void resizeEvent(QResizeEvent* event);
49     void paintGL();
50     void mouseDoubleClickEvent(QMouseEvent * event);
51
52 private:
53     int x, y, w, h;
54     int m_image_width, m_image_height;
55     GLuint m_texture, m_other_texture;
56     double m_display_ratio;
57     QColor m_backgroundColor;
58     Qt::WindowFlags m_baseFlags;
59 };
60
61 #endif