From 76b17e306bf070b3f405e2072e9710fb2ffb189c Mon Sep 17 00:00:00 2001 From: binary1248 Date: Mon, 30 May 2016 22:57:32 +0200 Subject: [PATCH] Added missing sRgb getter and setter to RenderTexture. --- include/SFML/Graphics/RenderTexture.hpp | 35 +++++++++++++++++++++++++ src/SFML/Graphics/RenderTexture.cpp | 14 ++++++++++ 2 files changed, 49 insertions(+) diff --git a/include/SFML/Graphics/RenderTexture.hpp b/include/SFML/Graphics/RenderTexture.hpp index 5fc6d217..2bd84c5c 100644 --- a/include/SFML/Graphics/RenderTexture.hpp +++ b/include/SFML/Graphics/RenderTexture.hpp @@ -108,6 +108,41 @@ public: //////////////////////////////////////////////////////////// bool isSmooth() const; + //////////////////////////////////////////////////////////// + /// \brief Enable or disable sRGB conversion + /// + /// When providing texture data from an image file or memory, it can + /// either be stored in a linear color space or an sRGB color space. + /// Most digital images account for gamma correction already, so they + /// would need to be "uncorrected" back to linear color space before + /// being processed by the hardware. The hardware can automatically + /// convert it from the sRGB color space to a linear color space when + /// it gets sampled. When the rendered image gets output to the final + /// framebuffer, it gets converted back to sRGB. + /// + /// After enabling or disabling sRGB conversion, make sure to re-draw + /// to the RenderTexture in order for the setting to take effect. + /// + /// This option is only useful in conjunction with an sRGB capable + /// framebuffer. This can be requested during window creation. + /// + /// \param sRgb True to enable sRGB conversion, false to disable it + /// + /// \see isSrgb + /// + //////////////////////////////////////////////////////////// + void setSrgb(bool sRgb); + + //////////////////////////////////////////////////////////// + /// \brief Tell whether sRGB conversion is enabled or not + /// + /// \return True if sRGB conversion is enabled, false if not + /// + /// \see setSrgb + /// + //////////////////////////////////////////////////////////// + bool isSrgb() const; + //////////////////////////////////////////////////////////// /// \brief Enable or disable texture repeating /// diff --git a/src/SFML/Graphics/RenderTexture.cpp b/src/SFML/Graphics/RenderTexture.cpp index 3678c808..f6a98b16 100644 --- a/src/SFML/Graphics/RenderTexture.cpp +++ b/src/SFML/Graphics/RenderTexture.cpp @@ -102,6 +102,20 @@ bool RenderTexture::isSmooth() const } +//////////////////////////////////////////////////////////// +void RenderTexture::setSrgb(bool sRgb) +{ + m_texture.setSrgb(sRgb); +} + + +//////////////////////////////////////////////////////////// +bool RenderTexture::isSrgb() const +{ + return m_texture.isSrgb(); +} + + //////////////////////////////////////////////////////////// void RenderTexture::setRepeated(bool repeated) {