diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-25 15:41:57 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-01-25 15:41:57 +0100 |
commit | 2c51c98625b225cecfb9628c30d62d4e30f7e3e1 (patch) | |
tree | 5f8f85a40785439b6a9ea249a75e81e26d1b44f1 /src/resources/image.h | |
parent | 8fdbae08d7f269c72889f89b56493071a2279350 (diff) | |
download | mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.gz mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.bz2 mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.tar.xz mana-2c51c98625b225cecfb9628c30d62d4e30f7e3e1.zip |
Ported to SDL2
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, |