From ae24c0dd7615d7f8a765fd7d76d7060b09e16ac4 Mon Sep 17 00:00:00 2001 From: Vraiment Date: Mon, 3 Jul 2017 21:50:49 -0700 Subject: [PATCH] Added Color support for Surface --- SDL2pp/Surface.cc | 6 +++--- SDL2pp/Surface.hh | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/SDL2pp/Surface.cc b/SDL2pp/Surface.cc index 7babeaf..5aa6434 100644 --- a/SDL2pp/Surface.cc +++ b/SDL2pp/Surface.cc @@ -147,8 +147,8 @@ SDL_BlendMode Surface::GetBlendMode() const { Color Surface::GetColorAndAlphaMod() const { Color color; - GetColorMod(color.r, color.g, color.b); - color.a = GetAlphaMod(); + GetColorMod(color.r, color.g, color.b); + color.SetAlpha(GetAlphaMod()); return color; } @@ -187,7 +187,7 @@ Surface& Surface::SetColorMod(Uint8 r, Uint8 g, Uint8 b) { return *this; } -Surface& Surface::SetColorAndAlphaMod(const Color& color) { +Surface& Surface::SetColorAndAlphaMod(const Color color) { return SetColorMod(color.r, color.g, color.b).SetAlphaMod(color.a); } diff --git a/SDL2pp/Surface.hh b/SDL2pp/Surface.hh index 7cacfdb..3b18bc5 100644 --- a/SDL2pp/Surface.hh +++ b/SDL2pp/Surface.hh @@ -398,7 +398,6 @@ public: /// /// \throws SDL2pp::Exception /// - /// \see http://wiki.libsdl.org/SDL_GetSurfaceAlphaMod /// \see http://wiki.libsdl.org/SDL_GetSurfaceColorMod /// //////////////////////////////////////////////////////////// @@ -500,11 +499,10 @@ public: /// /// \throws SDL2pp::Exception /// - /// \see http://wiki.libsdl.org/SDL_SetSurfaceAlphaMod /// \see http://wiki.libsdl.org/SDL_SetSurfaceColorMod /// //////////////////////////////////////////////////////////// - Surface& SetColorAndAlphaMod(const Color& color); + Surface& SetColorAndAlphaMod(const Color color); //////////////////////////////////////////////////////////// /// \brief Set the RLE acceleration hint for a surface