diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 10:13:40 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-26 10:13:40 +0100 |
commit | eb2e62609992ab8b47f8805f2bc2cafce271b66f (patch) | |
tree | 58d6c387f910e3a3348a6528127f4216b524ec57 /src/resources/image.h | |
parent | 05dc1666dc794ed6aa7f6568b768c652f8922c4e (diff) | |
parent | 8d06606835e3d01f537ebe96de8b216e64a1f969 (diff) | |
download | mana-lpc2012.tar.gz mana-lpc2012.tar.bz2 mana-lpc2012.tar.xz mana-lpc2012.zip |
Merge branch 'master' into lpc2012lpc2012
Diffstat (limited to 'src/resources/image.h')
-rw-r--r-- | src/resources/image.h | 58 |
1 files changed, 7 insertions, 51 deletions
diff --git a/src/resources/image.h b/src/resources/image.h index b762bf2a..efe2262e 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -37,8 +37,6 @@ #include <SDL_opengl.h> #endif -#include <map> - class Dye; class Position; @@ -129,12 +127,6 @@ class Image : public Resource */ Image *getSubImage(int x, int y, int width, int height); - /** - * Tells if the image has got an alpha channel - * @return true if it's true, false otherwise. - */ - bool hasAlphaChannel(); - // SDL only public functions /** @@ -146,31 +138,7 @@ class Image : public Resource static bool SDLisTransparencyDisabled() { return mDisableTransparency; } - /** - * Gets an scaled instance of an image. The returned image is managed - * by the ResourceManager. - * - * @param width The desired width of the scaled image. - * @param height The desired height of the scaled image. - * - * @return An Image resource, or 0 on failure. - */ - Image *SDLgetScaledImage(int width, int height); - - /** - * Get the alpha Channel of a SDL surface. - */ - Uint8 *SDLgetAlphaChannel() const - { return mAlphaChannel; } - - SDL_Surface* SDLduplicateSurface(SDL_Surface* tmpImage); - - void SDLcleanCache(); - - void SDLterminateAlphaCache(); - - static void SDLsetEnableAlphaCache(bool n) - { mEnableAlphaCache = n; } + static void setRenderer(SDL_Renderer *renderer); #ifdef USE_OPENGL @@ -204,30 +172,18 @@ class Image : public Resource // ----------------------- /** SDL Constructor */ - Image(SDL_Surface *image, bool hasAlphaChannel = false, - Uint8 *alphaChannel = NULL); + Image(SDL_Texture *texture, int width, int height); - /** SDL_Surface to SDL_Surface Image loader */ + /** SDL_Surface to SDL_Texture Image loader */ static Image *_SDLload(SDL_Surface *tmpImage); - SDL_Surface *getByAlpha(float alpha); - - SDL_Surface *mSDLSurface; - - /** Alpha Channel pointer used for 32bit based SDL surfaces */ - Uint8 *mAlphaChannel; - bool mHasAlphaChannel; - - /** Alpha cache: The cache stores a copy of the image - for specific requested opacities, hence, increasing - the image disply speed */ - std::map<float, SDL_Surface*> mAlphaCache; - bool mUseAlphaCache; - static bool mEnableAlphaCache; + SDL_Texture *mTexture; /** Stores whether the transparency is disabled */ static bool mDisableTransparency; + static SDL_Renderer *mRenderer; + // ----------------------- // OpenGL protected members // ----------------------- @@ -261,7 +217,7 @@ class Image : public Resource class SubImage : public Image { public: - SubImage(Image *parent, SDL_Surface *image, + SubImage(Image *parent, SDL_Texture *texture, int x, int y, int width, int height); #ifdef USE_OPENGL SubImage(Image *parent, GLuint image, int x, int y, |