diff --git a/SDL2pp/Texture.cc b/SDL2pp/Texture.cc index 6f33f2b..16c5b1d 100644 --- a/SDL2pp/Texture.cc +++ b/SDL2pp/Texture.cc @@ -1,6 +1,6 @@ /* libSDL2pp - C++11 bindings/wrapper for SDL2 - Copyright (C) 2013-2014 Dmitry Marakasov + Copyright (C) 2013-2015 Dmitry Marakasov This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -147,4 +147,23 @@ Point Texture::GetSize() const { return Point(w, h); } +Uint8 Texture::GetAlphaMod() const { + Uint8 alpha; + if (SDL_GetTextureAlphaMod(texture_, &alpha) != 0) + throw Exception("SDL_GetTextureAlphaMod failed"); + return alpha; +} + +SDL_BlendMode Texture::GetBlendMode() const { + SDL_BlendMode mode; + if (SDL_GetTextureBlendMode(texture_, &mode) != 0) + throw Exception("SDL_GetTextureBlendMode failed"); + return mode; +} + +void Texture::GetColorMod(Uint8& r, Uint8& g, Uint8 &b) const { + if (SDL_GetTextureColorMod(texture_, &r, &g, &b) != 0) + throw Exception("SDL_GetTextureBlendMode failed"); +} + } diff --git a/SDL2pp/Texture.hh b/SDL2pp/Texture.hh index 5509333..18fe936 100644 --- a/SDL2pp/Texture.hh +++ b/SDL2pp/Texture.hh @@ -425,6 +425,44 @@ public: /// //////////////////////////////////////////////////////////// Point GetSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the additional alpha value multiplied into render copy operations + /// + /// \return Current alpha value + /// + /// \throws SDL2pp::Exception + /// + /// \see http://wiki.libsdl.org/SDL_GetTextureAlphaMod + /// + //////////////////////////////////////////////////////////// + Uint8 GetAlphaMod() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the blend mode used for texture copy operations + /// + /// \return Current SDL_BlendMode + /// + /// \throws SDL2pp::Exception + /// + /// \see http://wiki.libsdl.org/SDL_GetTextureBlendMode + /// + //////////////////////////////////////////////////////////// + SDL_BlendMode GetBlendMode() const; + + //////////////////////////////////////////////////////////// + /// \brief Get the additional color value multiplied into render copy operations + /// + /// \param[out] r Variable to be filled in with the current red color value + /// \param[out] g Variable to be filled in with the current green color value + /// \param[out] b Variable to be filled in with the current blue color value + /// + /// \throws SDL2pp::Exception + /// + /// \see http://wiki.libsdl.org/SDL_GetTextureColorMod + /// + //////////////////////////////////////////////////////////// + void GetColorMod(Uint8& r, Uint8& g, Uint8 &b) const; }; }