ManaPlus
sdlimagehelper.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2017 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef RESOURCES_SDLIMAGEHELPER_H
24 #define RESOURCES_SDLIMAGEHELPER_H
25 
26 #ifdef USE_SDL2
28 RESOURCES_SDL2IMAGEHELPER_H
29 
30 #else
31 
32 #include "localconsts.h"
33 
34 #include "resources/imagehelper.h"
35 
36 class Dye;
37 class Image;
38 
43 {
44  friend class Image;
45 
46  public:
48  ImageHelper()
49  { }
50 
52 
54  { }
55 
65  Image *load(SDL_RWops *const rw,
66  Dye const &dye) override final A_WARN_UNUSED;
67 
71  Image *loadSurface(SDL_Surface *const tmpImage) override final
73 
74  Image *createTextSurface(SDL_Surface *const tmpImage,
75  const int width, const int height,
76  const float alpha)
77  override final A_WARN_UNUSED;
78 
79  void copySurfaceToImage(const Image *const image,
80  const int x, const int y,
81  SDL_Surface *const surface)
82  const override final;
83 
84  constexpr2 static void SDLSetEnableAlphaCache(const bool n) noexcept2
85  { mEnableAlphaCache = n; }
86 
87  static bool SDLGetEnableAlphaCache() noexcept2 A_WARN_UNUSED
88  { return mEnableAlphaCache; }
89 
90  static SDL_Surface* SDLDuplicateSurface(SDL_Surface *const tmpImage)
92 
93  static int combineSurface(SDL_Surface *restrict const src,
94  SDL_Rect *restrict const srcrect,
95  SDL_Surface *restrict const dst,
96  SDL_Rect *restrict const dstrect);
97 
98  protected:
100  Image *_SDLload(SDL_Surface *tmpImage) A_WARN_UNUSED;
101 
102  static bool mEnableAlphaCache;
103 };
104 
105 #endif // USE_SDL2
106 #endif // RESOURCES_SDLIMAGEHELPER_H
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
#define constexpr2
Definition: localconsts.h:48
#define A_WARN_UNUSED
Definition: localconsts.h:172
void copySurfaceToImage(const Image *const image, const int x, const int y, SDL_Surface *const surface) const
#define final
Definition: localconsts.h:45
Image * createTextSurface(SDL_Surface *const tmpImage, const int width, const int height, const float alpha)
static void SDLSetEnableAlphaCache(const bool n)
Image * loadSurface(SDL_Surface *const tmpImage)
Definition: dye.h:39
Image * _SDLload(SDL_Surface *tmpImage)
static int combineSurface(SDL_Surface *const src, SDL_Rect *const srcrect, SDL_Surface *const dst, SDL_Rect *const dstrect)
static SDL_Surface * SDLDuplicateSurface(SDL_Surface *const tmpImage)
Definition: image.h:61
#define restrict
Definition: localconsts.h:176
Image * load(SDL_RWops *const rw, Dye const &dye)
static bool mEnableAlphaCache
static bool SDLGetEnableAlphaCache()
#define noexcept2
Definition: localconsts.h:49