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  *
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_SUBIMAGE_H
24 #define RESOURCES_SUBIMAGE_H
25 
26 #include "localconsts.h"
27 
28 #include "resources/image/image.h"
29 
33 class SubImage final : public Image
34 {
35  public:
39 #ifdef USE_SDL2
40  SubImage(Image *const parent, SDL_Texture *const image,
41  const int x, const int y, const int width, const int height);
42 #endif // USE_SDL2
43 
44  SubImage(Image *const parent, SDL_Surface *const image,
45  const int x, const int y, const int width, const int height);
46 #ifdef USE_OPENGL
47  SubImage(Image *const parent, const GLuint image,
48  const int x, const int y, const int width, const int height,
49  const int texWidth, const int textHeight);
50 #endif // USE_OPENGL
51 
53 
54 
57  ~SubImage() override final;
58 
65  Image *getSubImage(const int x, const int y,
66  const int width,
67  const int height) override final A_WARN_UNUSED;
68 
70  { return ImageType::SubImage; }
71 
72  int calcMemoryLocal() const override;
73 
74 #ifdef USE_OPENGL
75  void decRef() override final;
76 #endif // USE_OPENGL
77 
78  SDL_Rect mInternalBounds;
79 
80  private:
82 };
83 
84 #endif // RESOURCES_SUBIMAGE_H
SubImage::mInternalBounds
SDL_Rect mInternalBounds
Definition: subimage.h:78
A_DELETE_COPY
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
ImageType::SubImage
@ SubImage
Definition: imagetype.h:29
Image
Definition: image.h:67
localconsts.h
noexcept2
#define noexcept2
Definition: localconsts.h:49
final
#define final
Definition: localconsts.h:45
SubImage::calcMemoryLocal
int calcMemoryLocal() const
Definition: subimage.cpp:230
image.h
x
x
Definition: graphics_calcImageRect.hpp:72
SubImage::~SubImage
~SubImage()
Definition: subimage.cpp:186
SubImage::getSubImage
Image * getSubImage(const int x, const int y, const int width, const int height)
Definition: subimage.cpp:215
SubImage::getType
ImageTypeT getType() const
Definition: subimage.h:69
override
#define override
Definition: localconsts.h:46
SubImage::mParent
Image * mParent
Definition: subimage.h:81
ImageTypeT
ImageType ::T ImageTypeT
Definition: imagetype.h:31
A_WARN_UNUSED
#define A_WARN_UNUSED
Definition: localconsts.h:160
SubImage::decRef
void decRef()
Definition: subimage.cpp:224
SubImage::SubImage
SubImage(Image *const parent, SDL_Surface *const image, const int x, const int y, const int width, const int height)
Definition: subimage.cpp:89
y
y
Definition: graphics_calcImageRect.hpp:72
SubImage
Definition: subimage.h:33