mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-04 03:15:59 -04:00
Added Color support for Surface
This commit is contained in:
parent
ddaee362a1
commit
b1cc4d5711
@ -145,6 +145,13 @@ SDL_BlendMode Surface::GetBlendMode() const {
|
|||||||
return blendMode;
|
return blendMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Color Surface::GetColorAndAlphaMod() const {
|
||||||
|
Color color;
|
||||||
|
GetColorMod(color.r, color.g, color.b);
|
||||||
|
color.SetAlpha(GetAlphaMod());
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
void Surface::GetColorMod(Uint8& r, Uint8& g, Uint8& b) const {
|
void Surface::GetColorMod(Uint8& r, Uint8& g, Uint8& b) const {
|
||||||
if (SDL_GetSurfaceColorMod(surface_, &r, &g, &b) != 0)
|
if (SDL_GetSurfaceColorMod(surface_, &r, &g, &b) != 0)
|
||||||
throw Exception("SDL_GetSurfaceColorMod");
|
throw Exception("SDL_GetSurfaceColorMod");
|
||||||
@ -180,6 +187,10 @@ Surface& Surface::SetColorMod(Uint8 r, Uint8 g, Uint8 b) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Surface& Surface::SetColorAndAlphaMod(const Color color) {
|
||||||
|
return SetColorMod(color.r, color.g, color.b).SetAlphaMod(color.a);
|
||||||
|
}
|
||||||
|
|
||||||
Surface& Surface::SetRLE(bool flag) {
|
Surface& Surface::SetRLE(bool flag) {
|
||||||
if (SDL_SetSurfaceRLE(surface_, flag ? 1 : 0) != 0)
|
if (SDL_SetSurfaceRLE(surface_, flag ? 1 : 0) != 0)
|
||||||
throw Exception("SDL_SetSurfaceRLE");
|
throw Exception("SDL_SetSurfaceRLE");
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <SDL2pp/Rect.hh>
|
#include <SDL2pp/Rect.hh>
|
||||||
#include <SDL2pp/Point.hh>
|
#include <SDL2pp/Point.hh>
|
||||||
#include <SDL2pp/Export.hh>
|
#include <SDL2pp/Export.hh>
|
||||||
|
#include <SDL2pp/Color.hh>
|
||||||
|
|
||||||
struct SDL_Surface;
|
struct SDL_Surface;
|
||||||
struct SDL_PixelFormat;
|
struct SDL_PixelFormat;
|
||||||
@ -390,6 +391,18 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
SDL_BlendMode GetBlendMode() const;
|
SDL_BlendMode GetBlendMode() const;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Get the additional color value multiplied into blit operations
|
||||||
|
///
|
||||||
|
/// \return Color object with the values used to do blit operations
|
||||||
|
///
|
||||||
|
/// \throws SDL2pp::Exception
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_GetSurfaceColorMod
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
Color GetColorAndAlphaMod() const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Get the additional color value multiplied into blit operations
|
/// \brief Get the additional color value multiplied into blit operations
|
||||||
///
|
///
|
||||||
@ -477,6 +490,20 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Surface& SetColorMod(Uint8 r = 255, Uint8 g = 255, Uint8 b = 255);
|
Surface& SetColorMod(Uint8 r = 255, Uint8 g = 255, Uint8 b = 255);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Set an additional color value multiplied into blit operations
|
||||||
|
///
|
||||||
|
/// \param[in] color Color to be multiplied into blit operations
|
||||||
|
///
|
||||||
|
/// \returns Reference to self
|
||||||
|
///
|
||||||
|
/// \throws SDL2pp::Exception
|
||||||
|
///
|
||||||
|
/// \see http://wiki.libsdl.org/SDL_SetSurfaceColorMod
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
Surface& SetColorAndAlphaMod(const Color color);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the RLE acceleration hint for a surface
|
/// \brief Set the RLE acceleration hint for a surface
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user