Commit ff65bec9 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Introduce a GLTexture::toImage helper class

parent 1ef90d9c
......@@ -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
......@@ -113,6 +113,8 @@ public:
GLenum filter() const;
GLenum internalFormat() const;
QImage toImage() const;
/** @short
* Make the texture fully transparent
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment