ManaPlus
subimage.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-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #ifndef RESOURCES_SUBIMAGE_H
25 #define RESOURCES_SUBIMAGE_H
26 
27 #include "localconsts.h"
28 
29 #include "resources/image/image.h"
30 
34 class SubImage final : public Image
35 {
36  public:
40 #ifdef USE_SDL2
41  SubImage(Image *const parent, SDL_Texture *const image,
42  const int x, const int y, const int width, const int height);
43 #endif // USE_SDL2
44 
45  SubImage(Image *const parent, SDL_Surface *const image,
46  const int x, const int y, const int width, const int height);
47 #ifdef USE_OPENGL
48  SubImage(Image *const parent, const GLuint image,
49  const int x, const int y, const int width, const int height,
50  const int texWidth, const int textHeight);
51 #endif // USE_OPENGL
52 
54 
55 
58  ~SubImage() override final;
59 
66  Image *getSubImage(const int x, const int y,
67  const int width,
68  const int height) override final A_WARN_UNUSED;
69 
71  { return ImageType::SubImage; }
72 
73  int calcMemoryLocal() const override;
74 
75 #ifdef USE_OPENGL
76  void decRef() override final;
77 #endif // USE_OPENGL
78 
79  SDL_Rect mInternalBounds;
80 
81  private:
83 };
84 
85 #endif // RESOURCES_SUBIMAGE_H
ImageTypeT getType() const
Definition: subimage.h:70
Image * mParent
Definition: subimage.h:82
int calcMemoryLocal() const
Definition: subimage.cpp:231
SDL_Rect mInternalBounds
Definition: subimage.h:79
SubImage(Image *const parent, SDL_Surface *const image, const int x, const int y, const int width, const int height)
Definition: subimage.cpp:90
Image * getSubImage(const int x, const int y, const int width, const int height)
Definition: subimage.cpp:216
void decRef()
Definition: subimage.cpp:225
ImageType ::T ImageTypeT
Definition: imagetype.h:32
#define override
Definition: localconsts.h:47
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define noexcept2
Definition: localconsts.h:50
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
@ SubImage
Definition: imagetype.h:30