Implement some Texture getters

This commit is contained in:
Dmitry Marakasov 2015-01-15 16:26:38 +03:00
parent e40e29dd8b
commit 04244eadf0
2 changed files with 58 additions and 1 deletions

View File

@ -1,6 +1,6 @@
/* /*
libSDL2pp - C++11 bindings/wrapper for SDL2 libSDL2pp - C++11 bindings/wrapper for SDL2
Copyright (C) 2013-2014 Dmitry Marakasov <amdmi3@amdmi3.ru> Copyright (C) 2013-2015 Dmitry Marakasov <amdmi3@amdmi3.ru>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages 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); 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");
}
} }

View File

@ -425,6 +425,44 @@ public:
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
Point GetSize() const; 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;
}; };
} }