diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-17 22:10:32 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-17 22:10:32 +0000 |
commit | 5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378 (patch) | |
tree | 1fb09db60c300ccf480796b73eeaf50454ab16e9 | |
parent | cf4a6be42ce03dde0caea52032f0403f3f96781a (diff) | |
download | mana-5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378.tar.gz mana-5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378.tar.bz2 mana-5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378.tar.xz mana-5b2fde1c744c9cc5d1a62c5177b8fb23dfee8378.zip |
Loaded images now converted to display format for speed, and added support
for masking on magic pink.
-rw-r--r-- | data/core/graphics/gui/textbox.png | bin | 311 -> 343 bytes | |||
-rw-r--r-- | src/resources/image.cpp | 8 |
2 files changed, 7 insertions, 1 deletions
diff --git a/data/core/graphics/gui/textbox.png b/data/core/graphics/gui/textbox.png Binary files differindex 487ed3cb..ccfb2bb1 100644 --- a/data/core/graphics/gui/textbox.png +++ b/data/core/graphics/gui/textbox.png diff --git a/src/resources/image.cpp b/src/resources/image.cpp index f3af2790..624036cf 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -25,6 +25,7 @@ #include "image.h" #include <iostream> #include <SDL_image.h> +#include "../graphic/graphic.h" Image::Image(SDL_Surface *image): image(image) @@ -42,7 +43,12 @@ Image* Image::load(const std::string &filePath) std::cout << "Image::load(" << filePath << ")\n"; #endif // Attempt to use SDL_Image to load the file. - SDL_Surface *image = IMG_Load(filePath.c_str()); + SDL_Surface *tmpImage = IMG_Load(filePath.c_str()); + SDL_Surface *image = SDL_ConvertSurface( + tmpImage, screen->format, SDL_SWSURFACE); + SDL_FreeSurface(tmpImage); + SDL_SetColorKey(image, SDL_SRCCOLORKEY | SDL_RLEACCEL, + SDL_MapRGB(image->format, 255, 0, 255)); // Check if the file was opened and return the appropriate value. if (!image) { |