ScummVM API documentation
image.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 STARK_VISUAL_IMAGE_H
23 #define STARK_VISUAL_IMAGE_H
24 
25 #include "engines/stark/visual/visual.h"
26 
27 #include "common/rect.h"
28 #include "common/stream.h"
29 
30 namespace Graphics {
31 struct Surface;
32 }
33 
34 namespace Stark {
35 
36 namespace Gfx {
37 class Driver;
38 class SurfaceRenderer;
39 class Bitmap;
40 }
41 
45 class VisualImageXMG : public Visual {
46 public:
47  static const VisualType TYPE = Visual::kImageXMG;
48 
49  explicit VisualImageXMG(Gfx::Driver *gfx);
50  ~VisualImageXMG() override;
51 
55  void load(Common::ReadStream *stream);
56 
60  void readOriginalSize(Common::ReadStream *stream);
61 
65  bool loadPNG(Common::SeekableReadStream *stream);
66 
67  void render(const Common::Point &position, bool useOffset);
68  void render(const Common::Point &position, bool useOffset, bool unscaled);
69 
71  void setHotSpot(const Common::Point &hotspot);
72  Common::Point getHotspot() const { return _hotspot; }
73 
79  void setFadeLevel(float fadeLevel);
80 
82  bool isPointSolid(const Common::Point &point) const;
83 
85  int getWidth() const;
86 
88  int getHeight() const;
89 
91  const Graphics::Surface *getSurface() const;
92 
93 private:
94  Graphics::Surface *multiplyColorWithAlpha(const Graphics::Surface *source);
95 
96  Gfx::Driver *_gfx;
97  Gfx::SurfaceRenderer *_surfaceRenderer;
98  Gfx::Bitmap *_bitmap;
99  Graphics::Surface *_surface;
100  Common::Point _hotspot;
101  uint _originalWidth;
102  uint _originalHeight;
103 };
104 
105 } // End of namespace Stark
106 
107 #endif // STARK_VISUAL_IMAGE_H
Definition: surface.h:67
Definition: visual.h:29
Definition: stream.h:745
Definition: surfacerenderer.h:36
Definition: driver.h:44
Definition: console.h:27
Definition: bitmap.h:38
Definition: formatinfo.h:28
Definition: rect.h:45
Definition: stream.h:385
Definition: image.h:45