ManaPlus
surfacegraphics.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-2018 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 RENDER_SURFACEGRAPHICS_H
24 #define RENDER_SURFACEGRAPHICS_H
25 
26 #include "enums/render/blitmode.h"
27 
28 #include "render/graphics.h"
29 
30 #include "localconsts.h"
31 
32 class Image;
33 class ImageCollection;
34 class ImageVertexes;
35 
40 {
41  public:
43 
45 
46  ~SurfaceGraphics() override final;
47 
48  void setTarget(SDL_Surface *restrict const target) restrict2 noexcept2
49  { mTarget = target; }
50 
51  SDL_Surface *getTarget() const restrict2 noexcept2
52  { return mTarget; }
53 
55  { }
56 
58  { }
59 
60  void pushClipArea(const Rect &restrict rect A_UNUSED)
61  restrict2 override final
62  { }
63 
65  { }
66 
67  void drawRescaledImage(const Image *restrict const image A_UNUSED,
68  int dstX A_UNUSED, int dstY A_UNUSED,
69  const int desiredWidth A_UNUSED,
70  const int desiredHeight A_UNUSED)
71  restrict2 override final
72  { }
73 
74  void drawPattern(const Image *restrict const image A_UNUSED,
75  const int x A_UNUSED,
76  const int y A_UNUSED,
77  const int w A_UNUSED,
78  const int h A_UNUSED) restrict2 override final
79  { }
80 
81  void drawRescaledPattern(const Image *const image A_UNUSED,
82  const int x A_UNUSED,
83  const int y A_UNUSED,
84  const int w A_UNUSED,
85  const int h A_UNUSED,
86  const int scaledWidth A_UNUSED,
87  const int scaledHeight A_UNUSED)
88  override final
89  { }
90 
92  const Image *restrict const image A_UNUSED,
93  const int x A_UNUSED,
94  const int y A_UNUSED,
95  const int w A_UNUSED,
96  const int h A_UNUSED) const restrict2 override final
97  { }
98 
100  const Image *restrict const image A_UNUSED,
101  const int x A_UNUSED,
102  const int y A_UNUSED,
103  const int w A_UNUSED,
104  const int h A_UNUSED) const restrict2 override final
105  { }
106 
108  const Image *restrict const image A_UNUSED,
109  int x A_UNUSED,
110  int y A_UNUSED) const restrict2 override final
111  A_NONNULL(2, 3)
112  { }
113 
115  int x A_UNUSED,
116  int y A_UNUSED) const restrict2 override final
117  { }
118 
120  vertCol A_UNUSED,
121  const Image *restrict const image A_UNUSED,
122  int x A_UNUSED,
123  int y A_UNUSED) restrict2 override final
124  { }
125 
127  vert A_UNUSED) restrict2 override final
128  { }
129 
131  vertCol A_UNUSED)
132  restrict2 override final A_NONNULL(2)
133  { }
134 
136  { }
137 
138  void drawNet(const int x1 A_UNUSED,
139  const int y1 A_UNUSED,
140  const int x2 A_UNUSED,
141  const int y2 A_UNUSED,
142  const int width A_UNUSED,
143  const int height A_UNUSED) restrict2 override final
144  { }
145 
147  const int x A_UNUSED, const int y A_UNUSED,
148  const int w A_UNUSED, const int h A_UNUSED,
149  const ImageRect &restrict imgRect A_UNUSED)
150  restrict2 override final A_NONNULL(2)
151  { }
152 
154  { mBlitMode = mode; }
155 
157  { return mBlitMode; }
158 
160  restrict2 override final
161  { }
162 
164  restrict2 override final
165  { }
166 
167  void drawPoint(int x A_UNUSED, int y A_UNUSED) restrict2 override final
168  { }
169 
170  void drawLine(int x1 A_UNUSED, int y1 A_UNUSED,
171  int x2 A_UNUSED, int y2 A_UNUSED)
172  restrict2 override final
173  { }
174 
175  bool setVideoMode(const int w A_UNUSED, const int h A_UNUSED,
176  const int scale A_UNUSED,
177  const int bpp A_UNUSED,
178  const bool fs A_UNUSED, const bool hwaccel A_UNUSED,
179  const bool resize A_UNUSED,
180  const bool noFrame A_UNUSED,
181  const bool allowHighDPI A_UNUSED)
182  restrict2 override final
183  { return false; }
184 
185  void drawImage(const Image *restrict const image,
186  int dstX, int dstY) restrict2 override final;
187 
188  void copyImage(const Image *restrict const image,
189  int dstX, int dstY) restrict2 override final;
190 
191  void drawImageCached(const Image *restrict const image,
192  int x, int y) restrict2 override final;
193 
194  void drawPatternCached(const Image *restrict const image A_UNUSED,
195  const int x A_UNUSED,
196  const int y A_UNUSED,
197  const int w A_UNUSED,
198  const int h A_UNUSED) restrict2 override final
199  { }
200 
201  void completeCache() restrict2 override final;
202 
207  void drawImageRect(const int x A_UNUSED, const int y A_UNUSED,
208  const int w A_UNUSED, const int h A_UNUSED,
209  const ImageRect &restrict imgRect A_UNUSED)
210  restrict2 override final
211  { }
212 
213  protected:
215  SDL_Surface *mTarget;
216 };
217 
218 #endif // RENDER_SURFACEGRAPHICS_H
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
void drawRescaledPattern(const Image *const image, const int x, const int y, const int w, const int h, const int scaledWidth, const int scaledHeight)
void drawLine(int x1, int y1, int x2, int y2)
void calcWindow(ImageCollection *const vertCol, const int x, const int y, const int w, const int h, const ImageRect &imgRect)
void drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height)
void setBlitMode(const BlitModeT mode)
Definition: rect.h:72
#define A_WARN_UNUSED
Definition: localconsts.h:152
void drawImageCached(const Image *const image, int x, int y)
#define final
Definition: localconsts.h:45
void calcPattern(ImageVertexes *const vert, const Image *const image, const int x, const int y, const int w, const int h) const
BlitModeT getBlitMode() const
SDL_Surface * getTarget() const
#define A_NONNULL(...)
Definition: localconsts.h:159
BlitMode ::T BlitModeT
Definition: blitmode.h:33
void pushClipArea(const Rect &rect)
void drawTileCollection(const ImageCollection *const vertCol)
void calcTileSDL(ImageVertexes *const vert, int x, int y) const
void calcTileCollection(ImageCollection *const vertCol, const Image *const image, int x, int y)
SDL_Surface * mTarget
void calcTileVertexes(ImageVertexes *const vert, const Image *const image, int x, int y) const
void drawImage(const Image *const image, int dstX, int dstY)
void drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight)
void calcPattern(ImageCollection *const vert, const Image *const image, const int x, const int y, const int w, const int h) const
void drawRectangle(const Rect &rect)
void setTarget(SDL_Surface *const target)
void drawImageRect(const int x, const int y, const int w, const int h, const ImageRect &imgRect)
void fillRectangle(const Rect &rect)
#define A_UNUSED
Definition: localconsts.h:151
bool setVideoMode(const int w, const int h, const int scale, const int bpp, const bool fs, const bool hwaccel, const bool resize, const bool noFrame, const bool allowHighDPI)
Definition: image.h:61
void drawTileVertexes(const ImageVertexes *const vert)
#define restrict
Definition: localconsts.h:156
#define override
Definition: localconsts.h:46
void drawPattern(const Image *const image, const int x, const int y, const int w, const int h)
void drawPatternCached(const Image *const image, const int x, const int y, const int w, const int h)
void drawPoint(int x, int y)
#define noexcept2
Definition: localconsts.h:49
void copyImage(const Image *const image, int dstX, int dstY)
#define restrict2
Definition: localconsts.h:157