From c54a021d8e2aa8682dd8ac33a63d34b1e1dff096 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Thu, 27 Aug 2015 18:21:31 +0300 Subject: [PATCH] Add Surface::GetFormat(), analogus to Texture::GetFormat() --- SDL2pp/Surface.cc | 4 ++++ SDL2pp/Surface.hh | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/SDL2pp/Surface.cc b/SDL2pp/Surface.cc index 3178ba0..7fc86fe 100644 --- a/SDL2pp/Surface.cc +++ b/SDL2pp/Surface.cc @@ -213,4 +213,8 @@ Point Surface::GetSize() const { return Point(surface_->w, surface_->h); } +Uint32 Surface::GetFormat() const { + return surface_->format->format; +} + } diff --git a/SDL2pp/Surface.hh b/SDL2pp/Surface.hh index 1703713..d932c2d 100644 --- a/SDL2pp/Surface.hh +++ b/SDL2pp/Surface.hh @@ -540,6 +540,17 @@ public: /// //////////////////////////////////////////////////////////// Point GetSize() const; + + //////////////////////////////////////////////////////////// + /// \brief Get texture format + /// + /// \return Surface raw format + /// + /// \see http://wiki.libsdl.org/SDL_Surface + /// \see http://wiki.libsdl.org/SDL_PixelFormatEnum + /// + //////////////////////////////////////////////////////////// + Uint32 GetFormat() const; }; }