diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-09 22:46:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-09 23:50:09 +0300 |
commit | ff11053f5f638749c3564c464dc41ebc474b4897 (patch) | |
tree | 8cf7ed8485528c7498612199c7ca56a6fd84f5e5 /src/resources/image.h | |
parent | b2c1c301b1e39fbbbb5bde3d4d55d14a9873b51f (diff) | |
download | mv-ff11053f5f638749c3564c464dc41ebc474b4897.tar.gz mv-ff11053f5f638749c3564c464dc41ebc474b4897.tar.bz2 mv-ff11053f5f638749c3564c464dc41ebc474b4897.tar.xz mv-ff11053f5f638749c3564c464dc41ebc474b4897.zip |
Move static methods from Image class to ImageHelper class.
Remove SDL merge method. It was very slow and unused.
Diffstat (limited to 'src/resources/image.h')
-rw-r--r-- | src/resources/image.h | 103 |
1 files changed, 1 insertions, 102 deletions
diff --git a/src/resources/image.h b/src/resources/image.h index 96bf0f95c..2a3f16c85 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -55,6 +55,7 @@ class Image : public Resource { friend class CompoundSprite; friend class Graphics; + friend class ImageHelper; #ifdef USE_OPENGL friend class OpenGLGraphics; friend class OpenGL1Graphics; @@ -67,36 +68,6 @@ class Image : public Resource virtual ~Image(); /** - * Loads an image from an SDL_RWops structure. - * - * @param rw The SDL_RWops to load the image from. - * - * @return <code>NULL</code> if an error occurred, a valid pointer - * otherwise. - */ - static Resource *load(SDL_RWops *rw); - - /** - * Loads an image from an SDL_RWops structure and recolors it. - * - * @param rw The SDL_RWops to load the image from. - * @param dye The dye used to recolor the image. - * - * @return <code>NULL</code> if an error occurred, a valid pointer - * otherwise. - */ - static Resource *load(SDL_RWops *rw, Dye const &dye); - - /** - * Loads an image from an SDL surface. - */ - static Image *load(SDL_Surface *); - - static SDL_Surface* convertTo32Bit(SDL_Surface* tmpImage); - - static Image *createTextSurface(SDL_Surface *tmpImage, float alpha); - - /** * Frees the resources created by SDL. */ virtual void unload(); @@ -120,12 +91,6 @@ class Image : public Resource { return mBounds.h; } /** - * Tells if the image was loaded using OpenGL or SDL - * @return true if OpenGL, false if SDL. - */ - int useOpenGL() const; - - /** * Tells if the image has got an alpha channel * @return true if it's true, false otherwise. */ @@ -164,72 +129,23 @@ class Image : public Resource Image* SDLgetScaledImage(int width, int height); /** - * Merges two image SDL_Surfaces together. This is for SDL use only, as - * reducing the number of surfaces that SDL has to render can cut down - * on the number of blit operations necessary, which in turn can help - * improve overall framerates. Don't use unless you are using it to - * reduce the number of overall layers that need to be drawn through SDL. - */ - Image *SDLmerge(Image *image, int x, int y); - - /** * 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 bool SDLGetEnableAlphaCache() - { return mEnableAlphaCache; } - - static void setEnableAlpha(bool n) - { mEnableAlpha = n; } - #ifdef USE_OPENGL - // OpenGL only public functions - /** - * Sets the target image format. Use <code>false</code> for SDL and - * <code>true</code> for OpenGL. - */ - static void setLoadAsOpenGL(int useOpenGL); - - static int getLoadAsOpenGL() - { return mUseOpenGL; } - int getTextureWidth() const { return mTexWidth; } int getTextureHeight() const { return mTexHeight; } - - static int getTextureType() - { return mTextureType; } - - static int getInternalTextureType() - { return mInternalTextureType; } - - static void setInternalTextureType(int n) - { mInternalTextureType = n; } - - static void setBlur(bool n) - { mBlur = n; } - - static int mTextureType; - - static int mInternalTextureType; - - static void dumpSurfaceFormat(SDL_Surface *image); - #endif bool isHasAlphaChannel() const @@ -267,9 +183,6 @@ class Image : public Resource Image(SDL_Surface *image, bool hasAlphaChannel = false, Uint8 *alphaChannel = nullptr); - /** SDL_Surface to SDL_Surface Image loader */ - static Image *_SDLload(SDL_Surface *tmpImage); - SDL_Surface *getByAlpha(float alpha); SDL_Surface *mSDLSurface; @@ -283,9 +196,6 @@ class Image : public Resource bool mIsAlphaVisible; bool mIsAlphaCalculated; - static bool mEnableAlphaCache; - static bool mEnableAlpha; - // ----------------------- // OpenGL protected members // ----------------------- @@ -296,19 +206,8 @@ class Image : public Resource Image(GLuint glimage, int width, int height, int texWidth, int texHeight); - /** - * Returns the first power of two equal or bigger than the input. - */ - static int powerOfTwo(int input); - - static Image *_GLload(SDL_Surface *tmpImage); - GLuint mGLImage; int mTexWidth, mTexHeight; - - static int mUseOpenGL; - static int mTextureSize; - static bool mBlur; #endif }; |