ScummVM API documentation
surface.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 SHERLOCK_SURFACE_H
23 #define SHERLOCK_SURFACE_H
24 
25 #include "common/rect.h"
26 #include "common/platform.h"
27 #include "graphics/screen.h"
28 #include "sherlock/fonts.h"
29 #include "sherlock/image_file.h"
30 
31 namespace Sherlock {
32 
33 #define SCALE_THRESHOLD 0x100
34 #define TRANSPARENCY 255
35 
41 class BaseSurface: public Graphics::Screen, public Fonts {
42 public:
46  BaseSurface();
47 
51  BaseSurface(int width, int height);
52  BaseSurface(int width_, int height_, const Graphics::PixelFormat &pf);
53 
57  virtual void SHblitFrom(const Graphics::Surface &src) {
59  }
60 
64  virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &destPos) {
66  }
67 
71  virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &destPos, const Common::Rect &srcBounds) {
72  Graphics::ManagedSurface::blitFrom(src, srcBounds, destPos);
73  }
74 
75  virtual void SHbitmapBlitFrom(const byte *src, int width, int height, int pitchSrc, const Common::Point &pt,
76  int overrideColor = 0);
77 
81  virtual void SHtransBlitFrom(const ImageFrame &src, const Common::Point &pt,
82  bool flipped = false, int overrideColor = 0, int scaleVal = SCALE_THRESHOLD);
83 
87  virtual void SHtransBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
88  bool flipped = false, int overrideColor = 0, int scaleVal = SCALE_THRESHOLD);
89 
93  virtual void SHfillRect(const Common::Rect &r, uint color) {
95  }
96 
100  virtual uint16 width() const { return this->w; }
101 
105  virtual uint16 height() const { return this->h; }
106 
110  void writeString(const Common::String &str, const Common::Point &pt, uint overrideColor);
111 
115  void writeFancyString(const Common::String &str, const Common::Point &pt, uint overrideColor1, uint overrideColor2);
116 };
117 
118 class Surface : public BaseSurface {
119 protected:
124  void addDirtyRect(const Common::Rect &r) override {}
125 public:
126  Surface() : BaseSurface() {}
127  Surface(int width_, int height_) : BaseSurface(width_, height_) {}
128  Surface(int width_, int height_, const Graphics::PixelFormat &pf) : BaseSurface(width_, height_, pf) {}
129 };
130 
131 } // End of namespace Sherlock
132 
133 #endif
void writeFancyString(const Common::String &str, const Common::Point &pt, uint overrideColor1, uint overrideColor2)
Definition: surface.h:118
void addDirtyRect(const Common::Rect &r) override
Definition: surface.h:124
virtual void SHblitFrom(const Graphics::Surface &src)
Definition: surface.h:57
Definition: str.h:59
int16 & w
Definition: managed_surface.h:117
Definition: surface.h:67
virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &destPos, const Common::Rect &srcBounds)
Definition: surface.h:71
Definition: pixelformat.h:138
virtual void SHblitFrom(const Graphics::Surface &src, const Common::Point &destPos)
Definition: surface.h:64
Definition: animation.h:29
Definition: rect.h:144
virtual void SHtransBlitFrom(const ImageFrame &src, const Common::Point &pt, bool flipped=false, int overrideColor=0, int scaleVal=0x100)
Definition: surface.h:41
Definition: screen.h:48
Definition: image_file.h:36
void blitFrom(const Surface &src, const Palette *srcPalette=nullptr)
int16 & h
Definition: managed_surface.h:118
virtual uint16 width() const
Definition: surface.h:100
void writeString(const Common::String &str, const Common::Point &pt, uint overrideColor)
Definition: rect.h:45
Definition: fonts.h:36
virtual uint16 height() const
Definition: surface.h:105
void fillRect(Common::Rect r, uint32 color)
Definition: managed_surface.h:754
virtual void SHfillRect(const Common::Rect &r, uint color)
Definition: surface.h:93