Introduce a GLTexture::toImage helper class
This commit is contained in:
parent
1ef90d9c90
commit
ff65bec92c
2 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue