2
* Copyright © 2010 Fredrik Höglund <fredrik@kde.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; see the file COPYING. if not, write to
16
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
* Boston, MA 02110-1301, USA.
23
#include <kwinglutils.h>
34
virtual ~BlurShader();
36
static BlurShader *create();
38
bool isValid() const {
42
// Sets the radius in pixels
43
void setRadius(int radius);
48
// Sets the blur direction
49
void setDirection(Qt::Orientation direction);
50
Qt::Orientation direction() const {
54
// Sets the distance between two pixels
55
virtual void setPixelDistance(float val) = 0;
56
virtual void setTextureMatrix(const QMatrix4x4 &matrix) = 0;
58
virtual void bind() = 0;
59
virtual void unbind() = 0;
62
float gaussian(float x, float sigma) const;
63
QVector<float> gaussianKernel() const;
64
void setIsValid(bool value) {
67
virtual void init() = 0;
68
virtual void reset() = 0;
69
virtual int maxKernelSize() const = 0;
73
Qt::Orientation mDirection;
78
// ----------------------------------------------------------------------------
82
class GLSLBlurShader : public BlurShader
88
void setPixelDistance(float val);
91
void setTextureMatrix(const QMatrix4x4 &matrix);
93
static bool supported();
98
int maxKernelSize() const;
106
// ----------------------------------------------------------------------------
110
class ARBBlurShader : public BlurShader
116
void setPixelDistance(float val);
119
void setTextureMatrix(const QMatrix4x4 &) {};
121
static bool supported();
126
int maxKernelSize() const;