Added Color support for Texture

This commit is contained in:
Vraiment 2017-07-03 22:30:39 -07:00
parent c9684f03d3
commit 2379a402d9
2 changed files with 3 additions and 5 deletions

View File

@ -157,7 +157,7 @@ Texture& Texture::SetColorMod(Uint8 r, Uint8 g, Uint8 b) {
return *this;
}
Texture& Texture::SetColorAndAlphaMod(const Color& color) {
Texture& Texture::SetColorAndAlphaMod(const Color color) {
return SetColorMod(color.r, color.g, color.b).SetAlphaMod(color.a);
}
@ -222,7 +222,7 @@ void Texture::GetColorMod(Uint8& r, Uint8& g, Uint8& b) const {
Color Texture::GetColorAndAlphaMod() const {
Color color;
GetColorMod(color.r, color.g, color.b);
color.a = GetAlphaMod();
color.SetAlpha(GetAlphaMod());
return color;
}

View File

@ -431,11 +431,10 @@ public:
///
/// \throws SDL2pp::Exception
///
/// \see http://wiki.libsdl.org/SDL_SetTextureAlphaMod
/// \see http://wiki.libsdl.org/SDL_SetTextureColorMod
///
////////////////////////////////////////////////////////////
Texture& SetColorAndAlphaMod(const Color& color = Color{255, 255, 255, SDL_ALPHA_OPAQUE});
Texture& SetColorAndAlphaMod(const Color color = Color{255, 255, 255, 255});
////////////////////////////////////////////////////////////
/// \brief Lock texture for write-only pixel access
@ -560,7 +559,6 @@ public:
///
/// \throws SDL2pp::Exception
///
/// \see http://wiki.libsdl.org/SDL_GetTextureAlphaMod
/// \see http://wiki.libsdl.org/SDL_GetTextureColorMod
///
////////////////////////////////////////////////////////////