ScummVM API documentation
asurface.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ACCESS_ASURFACE_H
23 #define ACCESS_ASURFACE_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/memstream.h"
28 #include "common/rect.h"
29 #include "graphics/screen.h"
30 #include "access/data.h"
31 
32 namespace Access {
33 
34 class SpriteResource;
35 class SpriteFrame;
36 
42 class BaseSurface : virtual public Graphics::Screen {
43 private:
44  Graphics::Surface _savedBlock;
45 
46  void flipHorizontal(BaseSurface &dest);
47 protected:
48  Common::Rect _savedBounds;
49 public:
50  int _leftSkip, _rightSkip;
51  int _topSkip, _bottomSkip;
52  int _lastBoundsX, _lastBoundsY;
53  int _lastBoundsW, _lastBoundsH;
54  int _orgX1, _orgY1;
55  int _orgX2, _orgY2;
56  int _lColor;
57 
58  Common::Point _printOrg;
59  Common::Point _printStart;
60  int _maxChars;
61 public:
62  static int _clipWidth, _clipHeight;
63 public:
64  BaseSurface();
65 
66  ~BaseSurface() override;
67 
68  void clearBuffer();
69 
70  void plotImage(SpriteResource *sprite, int frameNum, const Common::Point &pt);
71 
75  void sPlotF(SpriteFrame *frame, const Common::Rect &bounds);
76 
80  void sPlotB(SpriteFrame *frame, const Common::Rect &bounds);
81 
85  void plotF(SpriteFrame *frame, const Common::Point &pt);
86 
90  void plotB(SpriteFrame *frame, const Common::Point &pt);
91 
92  virtual void copyBlock(BaseSurface *src, const Common::Rect &bounds);
93 
94  virtual void restoreBlock();
95 
96  virtual void drawRect();
97 
98  virtual void drawLine(int x1, int y1, int x2, int y2, int col);
99 
100  virtual void drawLine();
101 
102  virtual void drawBox();
103 
104  virtual void copyBuffer(Graphics::ManagedSurface *src);
105 
106  void copyTo(BaseSurface *dest);
107 
108  void saveBlock(const Common::Rect &bounds);
109 
110  void moveBufferLeft();
111 
112  void moveBufferRight();
113 
114  void moveBufferUp();
115 
116  void moveBufferDown();
117 
118  bool clip(Common::Rect &r);
119 };
120 
121 class ASurface : public BaseSurface {
122 protected:
127  void addDirtyRect(const Common::Rect &r) override {}
128 public:
129  ASurface() : BaseSurface() {}
130 };
131 
132 class SpriteFrame : public ASurface {
133 public:
134  SpriteFrame(AccessEngine *vm, Common::SeekableReadStream *stream, int frameSize);
135  ~SpriteFrame() override;
136 };
137 
139 public:
141 public:
143  ~SpriteResource();
144 
145  int getCount() { return _frames.size(); }
146 
147  SpriteFrame *getFrame(int idx) { return _frames[idx]; }
148 };
149 
150 enum ImageFlag {
151  IMGFLAG_CROPPED = 1,
152  IMGFLAG_BACKWARDS = 2,
153  IMGFLAG_DRAWN = 4,
154  IMGFLAG_UNSCALED = 8
155 };
156 
157 class ImageEntry {
158 public:
159  int _frameNumber;
160  SpriteResource *_spritesPtr;
161  int _offsetY;
162  Common::Point _position;
163  int _flags;
164 public:
165  ImageEntry();
166 };
167 
168 class ImageEntryList : public Common::Array<ImageEntry> {
169 public:
170  void addToList(ImageEntry &ie);
171 };
172 
173 } // End of namespace Access
174 
175 #endif /* ACCESS_ASURFACE_H */
Definition: managed_surface.h:51
Definition: asurface.h:168
Definition: surface.h:67
void sPlotF(SpriteFrame *frame, const Common::Rect &bounds)
Definition: access.h:84
Definition: array.h:52
Definition: rect.h:144
Definition: stream.h:745
Definition: screen.h:48
Definition: asurface.h:42
Definition: asurface.h:132
void addDirtyRect(const Common::Rect &r) override
Definition: asurface.h:127
Definition: files.h:54
Definition: asurface.h:138
void sPlotB(SpriteFrame *frame, const Common::Rect &bounds)
void plotB(SpriteFrame *frame, const Common::Point &pt)
Definition: rect.h:45
size_type size() const
Definition: array.h:315
Definition: asurface.h:121
void plotF(SpriteFrame *frame, const Common::Point &pt)
Definition: access.h:62
Definition: asurface.h:157