Remove the old blur effect.
svn path=/trunk/KDE/kdebase/workspace/; revision=1099609
This commit is contained in:
parent
dc233bdcd5
commit
48c3a09119
8 changed files with 0 additions and 765 deletions
|
@ -1,20 +0,0 @@
|
|||
#######################################
|
||||
# Effect
|
||||
|
||||
# Source files
|
||||
set( kwin4_effect_builtins_sources ${kwin4_effect_builtins_sources}
|
||||
blur/blur.cpp
|
||||
)
|
||||
|
||||
# .desktop files
|
||||
install( FILES
|
||||
blur/blur.desktop
|
||||
DESTINATION ${SERVICES_INSTALL_DIR}/kwin )
|
||||
|
||||
# Data files
|
||||
install( FILES
|
||||
blur/data/blur.frag
|
||||
blur/data/blur.vert
|
||||
blur/data/blur-render.frag
|
||||
blur/data/blur-render.vert
|
||||
DESTINATION ${DATA_INSTALL_DIR}/kwin )
|
|
@ -1,388 +0,0 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#include "blur.h"
|
||||
|
||||
#include <kwinglutils.h>
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
KWIN_EFFECT( blur, BlurEffect )
|
||||
KWIN_EFFECT_SUPPORTED( blur, BlurEffect::supported() )
|
||||
|
||||
|
||||
BlurEffect::BlurEffect() : Effect()
|
||||
{
|
||||
mSceneTexture = 0;
|
||||
mTmpTexture = 0;
|
||||
mBlurTexture = 0;
|
||||
mSceneTarget = 0;
|
||||
mTmpTarget = 0;
|
||||
mBlurTarget = 0;
|
||||
mBlurShader = 0;
|
||||
mWindowShader = 0;
|
||||
|
||||
mBlurRadius = 4;
|
||||
mValid = loadData();
|
||||
if( !mValid )
|
||||
{
|
||||
kWarning(1212) << "Loading failed";
|
||||
}
|
||||
effects->addRepaintFull();
|
||||
}
|
||||
|
||||
BlurEffect::~BlurEffect()
|
||||
{
|
||||
effects->addRepaintFull();
|
||||
delete mSceneTexture;
|
||||
delete mTmpTexture;
|
||||
delete mBlurTexture;
|
||||
delete mSceneTarget;
|
||||
delete mTmpTarget;
|
||||
delete mBlurTarget;
|
||||
delete mBlurShader;
|
||||
delete mWindowShader;
|
||||
}
|
||||
|
||||
|
||||
bool BlurEffect::loadData()
|
||||
{
|
||||
// Create texture and render target
|
||||
int texw = displayWidth();
|
||||
int texh = displayHeight();
|
||||
if( !GLTexture::NPOTTextureSupported() )
|
||||
{
|
||||
kWarning( 1212 ) << "NPOT textures not supported, wasting some memory" ;
|
||||
texw = nearestPowerOfTwo(texw);
|
||||
texh = nearestPowerOfTwo(texh);
|
||||
}
|
||||
mSceneTexture = new GLTexture(texw, texh);
|
||||
mSceneTexture->setFilter(GL_LINEAR);
|
||||
mTmpTexture = new GLTexture(texw, texh);
|
||||
mTmpTexture->setFilter(GL_LINEAR);
|
||||
mBlurTexture = new GLTexture(texw, texh);
|
||||
|
||||
mSceneTarget = new GLRenderTarget(mSceneTexture);
|
||||
if( !mSceneTarget->valid() )
|
||||
return false;
|
||||
mTmpTarget = new GLRenderTarget(mTmpTexture);
|
||||
if( !mTmpTarget->valid() )
|
||||
return false;
|
||||
mBlurTarget = new GLRenderTarget(mBlurTexture);
|
||||
if( !mBlurTarget->valid() )
|
||||
return false;
|
||||
|
||||
mBlurShader = loadShader("blur");
|
||||
if( !mBlurShader )
|
||||
return false;
|
||||
mWindowShader = loadShader("blur-render");
|
||||
if( !mWindowShader )
|
||||
return false;
|
||||
|
||||
mBlurShader->bind();
|
||||
mBlurShader->setUniform("inputTex", 0);
|
||||
mBlurShader->setUniform("textureWidth", (float)texw);
|
||||
mBlurShader->setUniform("textureHeight", (float)texh);
|
||||
mBlurShader->unbind();
|
||||
|
||||
mWindowShader->bind();
|
||||
mWindowShader->setUniform("windowTex", 0);
|
||||
mWindowShader->setUniform("backgroundTex", 4);
|
||||
mWindowShader->setUniform("blurTextureWidth", (float)texw);
|
||||
mWindowShader->setUniform("blurTextureHeight", (float)texh);
|
||||
mWindowShader->unbind();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
GLShader* BlurEffect::loadShader(const QString& name)
|
||||
{
|
||||
QString fragmentshader = KGlobal::dirs()->findResource("data", "kwin/" + name + ".frag");
|
||||
QString vertexshader = KGlobal::dirs()->findResource("data", "kwin/" + name + ".vert");
|
||||
if(fragmentshader.isEmpty() || vertexshader.isEmpty())
|
||||
{
|
||||
kError(1212) << "Couldn't locate shader files for '" << name << "'" << endl;
|
||||
return false;
|
||||
}
|
||||
GLShader* shader = new GLShader(vertexshader, fragmentshader);
|
||||
if(!shader->isValid())
|
||||
{
|
||||
kError(1212) << "Shader '" << name << "' failed to load!" << endl;
|
||||
delete shader;
|
||||
return 0;
|
||||
}
|
||||
return shader;
|
||||
}
|
||||
|
||||
bool BlurEffect::supported()
|
||||
{
|
||||
return GLRenderTarget::supported() &&
|
||||
GLShader::fragmentShaderSupported() &&
|
||||
(effects->compositingType() == OpenGLCompositing);
|
||||
}
|
||||
|
||||
QRegion BlurEffect::expandedRegion( const QRegion& region ) const
|
||||
{
|
||||
QRegion expandedregion;
|
||||
foreach( const QRect& r, region.rects() )
|
||||
expandedregion += r.adjusted( -mBlurRadius, -mBlurRadius, mBlurRadius, mBlurRadius );
|
||||
return expandedregion;
|
||||
}
|
||||
|
||||
void BlurEffect::prePaintScreen( ScreenPrePaintData& data, int time )
|
||||
{
|
||||
mTransparentWindows = 0;
|
||||
mScreenDirty = QRegion();
|
||||
mBlurDirty = QRegion();
|
||||
mBlurMask = QRegion();
|
||||
|
||||
effects->prePaintScreen(data, time);
|
||||
}
|
||||
|
||||
void BlurEffect::prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time )
|
||||
{
|
||||
// Expand the painted area
|
||||
mBlurMask |= expandedRegion( data.paint );
|
||||
data.paint |= expandedRegion( mBlurMask );
|
||||
effects->prePaintWindow( w, data, time );
|
||||
|
||||
if( w->isPaintingEnabled() && ( data.mask & PAINT_WINDOW_TRANSLUCENT ))
|
||||
mTransparentWindows++;
|
||||
data.setTranslucent();
|
||||
}
|
||||
|
||||
void BlurEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
|
||||
{
|
||||
// TODO: prePaintWindow() gets called _after_ paintScreen(), so we have no
|
||||
// way of knowing here whether there will be any translucent windows or
|
||||
// not. If we'd know that there's no translucent windows then we could
|
||||
// render straight onto screen, saving some time.
|
||||
// HACK disable blur when there is a fullscreen effects. Needed for e.g. cube to work
|
||||
if( mValid && !effects->activeFullScreenEffect() /*&& mTransparentWindows*/ )
|
||||
{
|
||||
// rendering everything onto render target
|
||||
effects->pushRenderTarget(mSceneTarget);
|
||||
effects->paintScreen( mask, region, data );
|
||||
effects->popRenderTarget();
|
||||
|
||||
// Copy changed areas back onto screen
|
||||
mScreenDirty &= mBlurMask;
|
||||
if( !mScreenDirty.isEmpty() )
|
||||
{
|
||||
if( mask & PAINT_SCREEN_TRANSFORMED )
|
||||
{
|
||||
// We don't want any transformations when working with our own
|
||||
// textures, so load an identity matrix
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
GLTexture* tex = mSceneTexture;
|
||||
int pixels = 0;
|
||||
tex->bind();
|
||||
tex->enableUnnormalizedTexCoords();
|
||||
foreach( QRect r, mScreenDirty.rects() ) // krazy:exclude=foreach
|
||||
{
|
||||
r.adjust(0, -1, 0, -1);
|
||||
int rx2 = r.x() + r.width();
|
||||
int ry2 = r.y() + r.height();
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f( r.x(), ry2 ); glVertex2f( r.x(), ry2 );
|
||||
glTexCoord2f( rx2 , ry2 ); glVertex2f( rx2 , ry2 );
|
||||
glTexCoord2f( rx2 , r.y() ); glVertex2f( rx2 , r.y() );
|
||||
glTexCoord2f( r.x(), r.y() ); glVertex2f( r.x(), r.y() );
|
||||
glEnd();
|
||||
pixels += r.width()*r.height();
|
||||
}
|
||||
tex->disableUnnormalizedTexCoords();
|
||||
tex->unbind();
|
||||
|
||||
if( mask & PAINT_SCREEN_TRANSFORMED )
|
||||
{
|
||||
// Restore the original matrix
|
||||
glPopMatrix();
|
||||
}
|
||||
// kDebug(1212) << "Copied" << mScreenDirty.rects().count() << "rects, pixels:" << pixels;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
effects->paintScreen( mask, region, data );
|
||||
}
|
||||
}
|
||||
|
||||
void BlurEffect::drawWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data )
|
||||
{
|
||||
// HACK disable blur when there is a fullscreen effects. Needed for e.g. cube to work
|
||||
if( mValid && !effects->activeFullScreenEffect() /*&& mTransparentWindows*/ )
|
||||
{
|
||||
if( mask & PAINT_WINDOW_TRANSLUCENT &&
|
||||
((data.opacity != 1.0 || data.contents_opacity != 1.0 || data.decoration_opacity != 1.0 ) ||
|
||||
w->hasAlpha()))
|
||||
{
|
||||
|
||||
double blurAmount = data.opacity;
|
||||
if( blurAmount >= 1.0 )
|
||||
{
|
||||
blurAmount = data.contents_opacity;
|
||||
if( blurAmount >= 1.0 )
|
||||
{
|
||||
blurAmount = data.decoration_opacity;
|
||||
if( blurAmount >= 1.0 )
|
||||
blurAmount = 1.0;
|
||||
}
|
||||
}
|
||||
// Round to nearest 0.05
|
||||
blurAmount = double( qRound( blurAmount * 20.0 )) / 20.0;
|
||||
|
||||
// Make sure the blur texture is up to date
|
||||
if( mask & PAINT_SCREEN_TRANSFORMED )
|
||||
{
|
||||
// We don't want any transformations when working with our own
|
||||
// textures, so load an identity matrix
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
}
|
||||
// If we're having transformations, we don't know the window's
|
||||
// transformed position on the screen and thus have to update the
|
||||
// entire screen
|
||||
if( mask & ( PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS ) )
|
||||
updateBlurTexture( QRegion(0, 0, displayWidth(), displayHeight()) , blurAmount );
|
||||
else
|
||||
updateBlurTexture( mBlurDirty , blurAmount );
|
||||
mBlurDirty = QRegion();
|
||||
if( mask & PAINT_SCREEN_TRANSFORMED )
|
||||
// Restore the original matrix
|
||||
glPopMatrix();
|
||||
|
||||
// Set custom shader to render the window with
|
||||
mWindowShader->bind();
|
||||
data.shader = mWindowShader;
|
||||
// Put the blur texture to tex unit 4
|
||||
glActiveTexture(GL_TEXTURE4);
|
||||
mBlurTexture->bind();
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
||||
// Paint
|
||||
effects->drawWindow( w, mask, region, data );
|
||||
|
||||
// Disable blur texture and shader
|
||||
glActiveTexture(GL_TEXTURE4);
|
||||
mBlurTexture->unbind();
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
mWindowShader->unbind();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Opaque window
|
||||
// Paint to the rendertarget (which is already being used)
|
||||
effects->drawWindow( w, mask, region, data );
|
||||
}
|
||||
// Mark the window's region as dirty
|
||||
mScreenDirty += region;
|
||||
mBlurDirty += region & mBlurMask;
|
||||
}
|
||||
else
|
||||
// If there are no translucent windows then paint as usual
|
||||
effects->drawWindow( w, mask, region, data );
|
||||
}
|
||||
|
||||
void BlurEffect::updateBlurTexture(const QRegion& region, double blurAmount )
|
||||
{
|
||||
QRect bounding = region.boundingRect();
|
||||
QVector<QRect> rects = region.rects();
|
||||
int totalarea = 0;
|
||||
foreach( const QRect &r, rects )
|
||||
totalarea += r.width() * r.height();
|
||||
if( (int)(totalarea * 1.33 + 100 ) < bounding.width() * bounding.height() )
|
||||
{
|
||||
// Use small rects
|
||||
updateBlurTexture(rects, blurAmount);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Bounding rect is probably cheaper
|
||||
QVector<QRect> tmp( 1, bounding );
|
||||
updateBlurTexture( tmp , blurAmount );
|
||||
}
|
||||
}
|
||||
|
||||
void BlurEffect::updateBlurTexture(const QVector<QRect>& rects, double blurAmount )
|
||||
{
|
||||
// Blur
|
||||
// First pass (vertical)
|
||||
mBlurShader->bind();
|
||||
effects->pushRenderTarget(mTmpTarget);
|
||||
mBlurShader->setAttribute("xBlur", 0.0f);
|
||||
mBlurShader->setAttribute("yBlur", float(blurAmount) );
|
||||
|
||||
mSceneTexture->bind();
|
||||
|
||||
foreach( const QRect &r, rects )
|
||||
{
|
||||
// We change x coordinates here because horizontal blur pass (which
|
||||
// comes after this one) also uses pixels that are horizontally edging
|
||||
// the blurred area. Thus we need to make sure that those pixels are
|
||||
// also updated.
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f( r.x()-mBlurRadius , r.y() + r.height() );
|
||||
glVertex2f( r.x() + r.width()+mBlurRadius, r.y() + r.height() );
|
||||
glVertex2f( r.x() + r.width()+mBlurRadius, r.y() );
|
||||
glVertex2f( r.x()-mBlurRadius , r.y() );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
mSceneTexture->unbind();
|
||||
effects->popRenderTarget();
|
||||
|
||||
// Second pass (horizontal)
|
||||
effects->pushRenderTarget(mBlurTarget);
|
||||
mBlurShader->setAttribute("xBlur", float(blurAmount) );
|
||||
mBlurShader->setAttribute("yBlur", 0.0f);
|
||||
|
||||
mTmpTexture->bind();
|
||||
|
||||
foreach( const QRect &r, rects )
|
||||
{
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f( r.x() , r.y() + r.height() );
|
||||
glVertex2f( r.x() + r.width(), r.y() + r.height() );
|
||||
glVertex2f( r.x() + r.width(), r.y() );
|
||||
glVertex2f( r.x() , r.y() );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
mTmpTexture->unbind();
|
||||
effects->popRenderTarget();
|
||||
mBlurShader->unbind();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=Blur
|
||||
Name[af]=Blur
|
||||
Name[ar]=غشاوة
|
||||
Name[be]=Blur
|
||||
Name[bg]=Замъгляване
|
||||
Name[bn]=ব্লার
|
||||
Name[bn_IN]=Blur (ব্লার)
|
||||
Name[ca]=Difuminat
|
||||
Name[ca@valencia]=Difuminat
|
||||
Name[cs]=Rozostření
|
||||
Name[csb]=Rozmazóné
|
||||
Name[da]=Slør
|
||||
Name[de]=Verwischen
|
||||
Name[el]=Θόλωμα
|
||||
Name[en_GB]=Blur
|
||||
Name[eo]=Malklarigi
|
||||
Name[es]=Desenfocar
|
||||
Name[et]=Hägu
|
||||
Name[eu]=Lausotu
|
||||
Name[fa]=محو
|
||||
Name[fi]=Blur
|
||||
Name[fr]=Flou
|
||||
Name[fy]=Ferfagje
|
||||
Name[ga]=Blur
|
||||
Name[gl]=Desenfocar
|
||||
Name[gu]=ઝાંખું
|
||||
Name[he]=טשטש
|
||||
Name[hi]=धुंधला करें
|
||||
Name[hne]=धुंधला करव
|
||||
Name[hr]=Mrlja
|
||||
Name[hsb]=Młowojty
|
||||
Name[hu]=Elmosódás
|
||||
Name[id]=Samar
|
||||
Name[is]=Móða
|
||||
Name[it]=Sfocatura
|
||||
Name[ja]=ぼかし
|
||||
Name[kk]=Бұлдыр
|
||||
Name[km]=ព្រិល
|
||||
Name[kn]=ಮಾಸಲುಗೊಳಿಸು (ಬ್ಲರ್)
|
||||
Name[ko]=흐리게
|
||||
Name[ku]=Blur
|
||||
Name[lt]=Suliejimas
|
||||
Name[lv]=Aizmiglot
|
||||
Name[mai]=धुंधला करू
|
||||
Name[mk]=Заматување
|
||||
Name[ml]=മങ്ങിയതാക്കുക
|
||||
Name[mr]=पुसट
|
||||
Name[nb]=Slør
|
||||
Name[nds]=Verwischen
|
||||
Name[ne]=धब्बा
|
||||
Name[nl]=Vervagen
|
||||
Name[nn]=Uklar
|
||||
Name[pa]=ਧੁੰਦਲਾ
|
||||
Name[pl]=Rozmycie
|
||||
Name[pt]=BlueFish
|
||||
Name[pt_BR]=Borrar
|
||||
Name[ro]=Estompare
|
||||
Name[ru]=Размытие
|
||||
Name[se]=Seagas
|
||||
Name[si]=අපැහැදිලි කිරීම
|
||||
Name[sk]=Rozmazanie
|
||||
Name[sl]=Zameglitev
|
||||
Name[sr]=Замућење
|
||||
Name[sr@ijekavian]=Замућење
|
||||
Name[sr@ijekavianlatin]=Zamućenje
|
||||
Name[sr@latin]=Zamućenje
|
||||
Name[sv]=Oskärpa
|
||||
Name[ta]=மங்கலாக
|
||||
Name[te]=బ్లర్
|
||||
Name[tg]=Шуста
|
||||
Name[th]=ทำให้ไม่ชัดเจน
|
||||
Name[tr]=Bulanıklaştırma
|
||||
Name[uk]=Розмивання
|
||||
Name[vi]=Che mờ
|
||||
Name[wa]=Flou
|
||||
Name[x-test]=xxBlurxx
|
||||
Name[zh_CN]=模糊
|
||||
Name[zh_TW]=模糊
|
||||
Icon=preferences-system-windows-effect-blur
|
||||
Comment=Blurs the background behind semi-transparent windows
|
||||
Comment[ar]=تغشي الخلفية التي خلف النوافذ شبه الشفافة.
|
||||
Comment[bg]=Замъгляване на фона на полупрозрачни прозорци
|
||||
Comment[ca]=Difumina el fons de darrere de les finestres semitransparents
|
||||
Comment[ca@valencia]=Difumina el fons de darrere de les finestres semitransparents
|
||||
Comment[cs]=Rozostří pozadí poloprůhledných oken
|
||||
Comment[csb]=Rozmazëje spòdla półprzezérnych òknów
|
||||
Comment[da]=Slører baggrunden bag halvgennemsigtige vinduer
|
||||
Comment[de]=Verwischt den Hintergrund halbtransparenter Fenster.
|
||||
Comment[el]=Θόλωμα του φόντου πίσω από ημιδιαφανή παράθυρα
|
||||
Comment[en_GB]=Blurs the background behind semi-transparent windows
|
||||
Comment[eo]=Malklarigas la fonon de duon-travideblaj fenestroj
|
||||
Comment[es]=Desenfoca el fondo de una ventana semi-transparente
|
||||
Comment[et]=Poolläbipaistvate akende tausta hägustamine
|
||||
Comment[eu]=Lausto atzekoaldea leiho erdigardenen atzean
|
||||
Comment[fi]=Sumentaa puoliksi läpinäkyvien ikkunoiden taustan
|
||||
Comment[fr]=Rend flou l'arrière-plan sous les fenêtres semi-transparentes
|
||||
Comment[fy]=Ferfaget de eftergrûn fan healtrochsichtige finsters
|
||||
Comment[ga]=Geamhaigh an cúlra taobh thiar d'fhuinneoga leath-thrédhearcacha
|
||||
Comment[gl]=Desenfoca o fondo tras das fiestras semitransparentes
|
||||
Comment[gu]=પાશ્વભાગને અર્ધ-પારદર્શક વિન્ડોઝમાં ઝાંખું કરે છે
|
||||
Comment[he]=טישטוש הרקע של חלונות שקופים למחצה
|
||||
Comment[hi]=अर्ध-पारदर्शी विंडो के पीछे पृष्ठभूमि को धुंधला करता है
|
||||
Comment[hne]=अल्पपारदर्सी विंडो के पिछोत अंगना ल धुंधला करथे
|
||||
Comment[hr]=Zamrlja pozadinu iza poluprozirnih prozora
|
||||
Comment[hsb]=Stwori młowojty pozadk za połpřewidnymi woknami.
|
||||
Comment[hu]=Elmosódottá teszi a félig áttetsző ablakok hátterét
|
||||
Comment[id]=Samarkan latar belakang di belakang jendela semi-transparan
|
||||
Comment[is]=Móðar bakgrunn aftan við hálfgegnsæa glugga
|
||||
Comment[it]=Sfoca lo sfondo dietro le finestre semitrasparenti
|
||||
Comment[ja]=半透明のウィンドウの背後をぼかします
|
||||
Comment[kk]=Шала мөлдір терезелердің аясын бұлдырлатады
|
||||
Comment[km]=ធ្វើឲ្យផ្ទៃខាងក្រោយព្រិលៗខាងក្រោយបង្អួចថ្លាពាក់កណ្ដាល
|
||||
Comment[kn]=ಅರೆ-ಪಾರದರ್ಶಕ ಕಿಟಕಿಗಳ ಹಿನ್ನೆಲೆಯನ್ನು ಮಾಸಲುಗೊಳಿಸುತ್ತದೆ
|
||||
Comment[ko]=반투명 창의 뒷배경을 흐리게 합니다
|
||||
Comment[lt]=Sulieja pusiau permatomų langų foną
|
||||
Comment[lv]=Aizmiglo fonu aiz puscaurspīdīgiem logiem
|
||||
Comment[mk]=Ја заматува подлогата зад полупроѕирни прозорци
|
||||
Comment[ml]=പാതിസുതാര്യ ജാലകങ്ങളുടെ പിന്നാമ്പുറം മങ്ങിയതാക്കുന്നു.
|
||||
Comment[mr]=अर्ध-पारदर्शी चौकटची पार्श्वभूमी फुसट करतो
|
||||
Comment[nb]=Slører bakgrunnen til delvis gjennomsiktige vinduer
|
||||
Comment[nds]=Verwischt den Achtergrund achter halfdörsichtig Finstern
|
||||
Comment[nl]=Vervaagt de achtergrond van halftransparante vensters
|
||||
Comment[nn]=Gjer bakgrunnen til halvgjennomsiktige vindauge uklar
|
||||
Comment[pa]=ਬਲੌਰੀ (ਅਰਧ-ਪਾਰਦਰਸ਼ੀ) (ਬਲਰ) ਵਿੰਡੋਜ਼ ਲਈ ਧੁੰਦਲੀ ਬੈਕਗਰਾਊਂਡ
|
||||
Comment[pl]=Rozmywa tło za półprzezroczystymi oknami
|
||||
Comment[pt]=Borra o fundo por trás das janelas semi-transparentes
|
||||
Comment[pt_BR]=Borra o plano de fundo por trás das janelas semi-transparentes
|
||||
Comment[ro]=Estompează fundalul în spatele ferestrelor semitransparente
|
||||
Comment[ru]=Показывать размытый фон под полупрозрачным окном
|
||||
Comment[si]=අර්ධ පාරදෘශ්ය කවුළු පසුපසින් පසුබිම අපැහැදිලි කරන්න
|
||||
Comment[sk]=Rozmaže pozadie za polopriehľadnými oknami
|
||||
Comment[sl]=Zamegli ozadje za na pol prozornmi okni
|
||||
Comment[sr]=Замућује позадину иза полупровидних прозора
|
||||
Comment[sr@ijekavian]=Замућује позадину иза полупровидних прозора
|
||||
Comment[sr@ijekavianlatin]=Zamućuje pozadinu iza poluprovidnih prozora
|
||||
Comment[sr@latin]=Zamućuje pozadinu iza poluprovidnih prozora
|
||||
Comment[sv]=Gör bakgrunden bakom halvgenomskinliga fönster suddig
|
||||
Comment[ta]=Blurs the background behind semi-transparent windows
|
||||
Comment[th]=ทำให้พื้นหลังของหน้าต่างแบบกึ่งโปร่งใสดูไม่ชัดเจน
|
||||
Comment[tr]=Yarı şeffaf pencerelerin arkaplanını bulanıklaştırır
|
||||
Comment[uk]=Розмивання тла напівпрозорих вікон
|
||||
Comment[wa]=Rind flou l' fond pa drî les purneas dmey transparints
|
||||
Comment[x-test]=xxBlurs the background behind semi-transparent windowsxx
|
||||
Comment[zh_CN]=模糊半透明窗口的背景
|
||||
Comment[zh_TW]=將半透明視窗後的背景弄模糊
|
||||
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KWin/Effect
|
||||
X-KDE-PluginInfo-Author=Rivo Laks
|
||||
X-KDE-PluginInfo-Email=rivolaks@hot.ee
|
||||
X-KDE-PluginInfo-Name=kwin4_effect_blur
|
||||
X-KDE-PluginInfo-Version=0.2.0
|
||||
X-KDE-PluginInfo-Category=Appearance
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=false
|
||||
X-KDE-Library=kwin4_effect_builtins
|
||||
X-KDE-Ordering=85
|
|
@ -1,86 +0,0 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef KWIN_BLUR_H
|
||||
#define KWIN_BLUR_H
|
||||
|
||||
// Include with base class for effects.
|
||||
#include <kwineffects.h>
|
||||
|
||||
#include <QRegion>
|
||||
|
||||
template< class T > class QVector;
|
||||
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class GLRenderTarget;
|
||||
class GLTexture;
|
||||
class GLShader;
|
||||
|
||||
/**
|
||||
* Blurs the background of translucent windows
|
||||
**/
|
||||
class BlurEffect : public Effect
|
||||
{
|
||||
public:
|
||||
BlurEffect();
|
||||
~BlurEffect();
|
||||
|
||||
virtual void prePaintScreen( ScreenPrePaintData& data, int time );
|
||||
virtual void paintScreen( int mask, QRegion region, ScreenPaintData& data );
|
||||
|
||||
virtual void prePaintWindow( EffectWindow* w, WindowPrePaintData& data, int time );
|
||||
virtual void drawWindow( EffectWindow* w, int mask, QRegion region, WindowPaintData& data );
|
||||
|
||||
static bool supported();
|
||||
|
||||
protected:
|
||||
bool loadData();
|
||||
GLShader* loadShader(const QString& name);
|
||||
void updateBlurTexture(const QVector<QRect>& rects, double blurAmount );
|
||||
void updateBlurTexture(const QRegion& region , double blurAmount );
|
||||
|
||||
QRegion expandedRegion( const QRegion& r ) const;
|
||||
|
||||
private:
|
||||
GLTexture* mSceneTexture;
|
||||
GLTexture* mTmpTexture;
|
||||
GLTexture* mBlurTexture;
|
||||
GLRenderTarget* mSceneTarget;
|
||||
GLRenderTarget* mTmpTarget;
|
||||
GLRenderTarget* mBlurTarget;
|
||||
GLShader* mBlurShader;
|
||||
GLShader* mWindowShader;
|
||||
bool mValid;
|
||||
int mBlurRadius;
|
||||
|
||||
int mTransparentWindows;
|
||||
|
||||
QRegion mBlurDirty;
|
||||
QRegion mScreenDirty;
|
||||
|
||||
QRegion mBlurMask;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
|
@ -1,40 +0,0 @@
|
|||
uniform sampler2D windowTex;
|
||||
uniform sampler2D backgroundTex;
|
||||
uniform float blurTextureWidth;
|
||||
uniform float blurTextureHeight;
|
||||
uniform float opacity;
|
||||
uniform float saturation;
|
||||
uniform float brightness;
|
||||
|
||||
|
||||
// Converts pixel coordinates to texture coordinates
|
||||
vec2 pix2tex(vec2 pix)
|
||||
{
|
||||
return vec2(pix.x / blurTextureWidth, pix.y / blurTextureHeight);
|
||||
}
|
||||
|
||||
// Returns color of the window at given texture coordinate, taking into
|
||||
// account brightness and saturation, but not opacity
|
||||
vec4 windowColor(vec2 texcoord)
|
||||
{
|
||||
vec4 color = texture2D(windowTex, texcoord);
|
||||
// Apply saturation
|
||||
float grayscale = dot(vec3(0.30, 0.59, 0.11), color.rgb);
|
||||
color.rgb = mix(vec3(grayscale), color.rgb, saturation);
|
||||
// Apply brightness
|
||||
color.rgb = color.rgb * brightness;
|
||||
// and return
|
||||
return color;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 blurtexcoord = pix2tex(gl_FragCoord.xy);
|
||||
|
||||
vec4 winColor = windowColor(gl_TexCoord[0].xy);
|
||||
vec3 tex = mix(texture2D(backgroundTex, blurtexcoord).rgb,
|
||||
winColor.rgb, winColor.a * opacity);
|
||||
|
||||
gl_FragColor = vec4(tex, pow(winColor.a, 0.2));
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0 * gl_TextureMatrix[0];
|
||||
gl_Position = ftransform();
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
uniform sampler2D inputTex;
|
||||
|
||||
varying vec2 samplePos1;
|
||||
varying vec2 samplePos2;
|
||||
varying vec2 samplePos3;
|
||||
varying vec2 samplePos4;
|
||||
varying vec2 samplePos5;
|
||||
|
||||
|
||||
// If defined, use five samples (blur radius = 5), otherwise 3 samples (radius = 3)
|
||||
#define FIVE_SAMPLES
|
||||
|
||||
|
||||
vec3 blurTex(vec2 pos, float strength)
|
||||
{
|
||||
return texture2D(inputTex, pos).rgb * strength;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// Do the gaussian blur
|
||||
// This blur actually has a radius of 4, but we take advantage of gpu's
|
||||
// linear texture filtering, so e.g. 1.5 actually gives us both texels
|
||||
// 1 and 2
|
||||
#ifdef FIVE_SAMPLES
|
||||
vec3 tex = blurTex(samplePos1, 0.30);
|
||||
tex += blurTex(samplePos2, 0.25);
|
||||
tex += blurTex(samplePos3, 0.25);
|
||||
tex += blurTex(samplePos4, 0.1);
|
||||
tex += blurTex(samplePos5, 0.1);
|
||||
#else
|
||||
vec3 tex = blurTex(samplePos1, 0.40);
|
||||
tex += blurTex(samplePos2, 0.30);
|
||||
tex += blurTex(samplePos3, 0.30);
|
||||
#endif
|
||||
|
||||
gl_FragColor = vec4(tex, 1.0);
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
varying vec2 samplePos1;
|
||||
varying vec2 samplePos2;
|
||||
varying vec2 samplePos3;
|
||||
varying vec2 samplePos4;
|
||||
varying vec2 samplePos5;
|
||||
|
||||
uniform float textureWidth;
|
||||
uniform float textureHeight;
|
||||
attribute float xBlur;
|
||||
attribute float yBlur;
|
||||
|
||||
|
||||
vec2 mkSamplePos(vec2 origin, float offset)
|
||||
{
|
||||
vec2 foo = origin + vec2(xBlur, yBlur) * offset;
|
||||
return vec2(foo.x / textureWidth, 1.0 - foo.y / textureHeight);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
samplePos1 = mkSamplePos(gl_Vertex.xy, 0.0);
|
||||
samplePos2 = mkSamplePos(gl_Vertex.xy, -1.5);
|
||||
samplePos3 = mkSamplePos(gl_Vertex.xy, 1.5);
|
||||
samplePos4 = mkSamplePos(gl_Vertex.xy, 3.5);
|
||||
samplePos5 = mkSamplePos(gl_Vertex.xy, -3.5);
|
||||
|
||||
gl_Position = ftransform();
|
||||
}
|
Loading…
Reference in a new issue