summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorEric Scrivner <zenogais@gmail.com>2005-02-19 02:30:09 +0000
committerEric Scrivner <zenogais@gmail.com>2005-02-19 02:30:09 +0000
commit202fdb7698b3329bd1a01f54780e83a08ae3065c (patch)
treefa4da255abbc90a038bbabb4da3fc2f77d78efce /src/resources/image.cpp
parentf71a143f37a9cc6b64f4231bb582d736c3d34a0b (diff)
downloadmana-client-202fdb7698b3329bd1a01f54780e83a08ae3065c.tar.gz
mana-client-202fdb7698b3329bd1a01f54780e83a08ae3065c.tar.bz2
mana-client-202fdb7698b3329bd1a01f54780e83a08ae3065c.tar.xz
mana-client-202fdb7698b3329bd1a01f54780e83a08ae3065c.zip
Added load function that uses SDL_RWops
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 2ec867ec..2798fa05 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -198,6 +198,23 @@ Image* Image::load(const std::string &filePath, int flags)
#endif
}
+Image* Image::load(const char* buffer, const unsigned int bufferSize)
+{
+ // Define our RWops structure
+ SDL_RWops* rw = NULL;
+
+ // Load the raw file data from the buffer
+ rw = SDL_RWFromMem((void*)buffer, bufferSize);
+
+ // Use SDL_Image to load the raw image data
+ SDL_Surface* texture = IMG_Load_RW(rw, 1);
+
+ // Now free the SDL_RWops data
+ //SDL_FreeRW(rw);
+
+ return new Image(texture);
+}
+
void Image::unload()
{
// Free the image surface.