Update fbo toImage() docs regarding premultiplied alpha
Task-number: QTBUG-42510 Task-number: QTBUG-37261 Change-Id: Ic11bec0a25e66df9d022f640621686be867e84d2 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
parent
f1aafb595b
commit
954552ceac
@ -1203,9 +1203,23 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format,
|
|||||||
If used together with QOpenGLPaintDevice, \a flipped should be the opposite of the value
|
If used together with QOpenGLPaintDevice, \a flipped should be the opposite of the value
|
||||||
of QOpenGLPaintDevice::paintFlipped().
|
of QOpenGLPaintDevice::paintFlipped().
|
||||||
|
|
||||||
Will try to return a premultiplied ARBG32 or RGB32 image. Since 5.2 it will fall back to
|
The returned image has a format of premultiplied ARGB32 or RGB32. The latter is used
|
||||||
a premultiplied RGBA8888 or RGBx8888 image when reading to ARGB32 is not supported. Since 5.4 an
|
only when internalTextureFormat() is set to \c GL_RGB.
|
||||||
A2BGR30 image is returned if the internal format is RGB10_A2.
|
|
||||||
|
If the rendering in the framebuffer was not done with premultiplied alpha in mind,
|
||||||
|
create a wrapper QImage with a non-premultiplied format. This is necessary before
|
||||||
|
performing operations like QImage::save() because otherwise the image data would get
|
||||||
|
unpremultiplied, even though it was not premultiplied in the first place. To create
|
||||||
|
such a wrapper without performing a copy of the pixel data, do the following:
|
||||||
|
|
||||||
|
\code
|
||||||
|
QImage fboImage(fbo.toImage());
|
||||||
|
QImage image(fboImage.constBits(), fboImage.width(), fboImage.height(), QImage::Format_ARGB32);
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
Since Qt 5.2 the function will fall back to premultiplied RGBA8888 or RGBx8888 when
|
||||||
|
reading to (A)RGB32 is not supported. Since 5.4 an A2BGR30 image is returned if the
|
||||||
|
internal format is RGB10_A2.
|
||||||
|
|
||||||
For multisampled framebuffer objects the samples are resolved using the
|
For multisampled framebuffer objects the samples are resolved using the
|
||||||
\c{GL_EXT_framebuffer_blit} extension. If the extension is not available, the contents
|
\c{GL_EXT_framebuffer_blit} extension. If the extension is not available, the contents
|
||||||
|
@ -1111,6 +1111,20 @@ QGLFramebufferObjectFormat QGLFramebufferObject::format() const
|
|||||||
|
|
||||||
Returns the contents of this framebuffer object as a QImage.
|
Returns the contents of this framebuffer object as a QImage.
|
||||||
|
|
||||||
|
The returned image has a format of premultiplied ARGB32 or RGB32. The latter is used
|
||||||
|
only when internalTextureFormat() is set to \c GL_RGB.
|
||||||
|
|
||||||
|
If the rendering in the framebuffer was not done with premultiplied alpha in mind,
|
||||||
|
create a wrapper QImage with a non-premultiplied format. This is necessary before
|
||||||
|
performing operations like QImage::save() because otherwise the image data would get
|
||||||
|
unpremultiplied, even though it was not premultiplied in the first place. To create
|
||||||
|
such a wrapper without performing a copy of the pixel data, do the following:
|
||||||
|
|
||||||
|
\code
|
||||||
|
QImage fboImage(fbo.toImage());
|
||||||
|
QImage image(fboImage.constBits(), fboImage.width(), fboImage.height(), QImage::Format_ARGB32);
|
||||||
|
\endcode
|
||||||
|
|
||||||
On QNX the back buffer is not preserved when a buffer swap occures. So this function
|
On QNX the back buffer is not preserved when a buffer swap occures. So this function
|
||||||
might return old content.
|
might return old content.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user