diff --git a/libkwineffects/kwingltexture.cpp b/libkwineffects/kwingltexture.cpp index 467fbbfb3d..87664ada20 100644 --- a/libkwineffects/kwingltexture.cpp +++ b/libkwineffects/kwingltexture.cpp @@ -683,4 +683,11 @@ bool GLTexture::supportsFormatRG() return GLTexturePrivate::s_supportsTextureFormatRG; } +QImage GLTexture::toImage() const +{ + QImage ret(size(), QImage::Format_RGBA8888_Premultiplied); + glGetTextureImage(texture(), 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, ret.sizeInBytes(), ret.bits()); + return ret; +} + } // namespace KWin diff --git a/libkwineffects/kwingltexture.h b/libkwineffects/kwingltexture.h index 09474466a4..4620362a6c 100644 --- a/libkwineffects/kwingltexture.h +++ b/libkwineffects/kwingltexture.h @@ -113,6 +113,8 @@ public: GLenum filter() const; GLenum internalFormat() const; + QImage toImage() const; + /** @short * Make the texture fully transparent */