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_RESOURCES_IMAGE_H
23 #define STARK_RESOURCES_IMAGE_H
24 
25 #include "common/path.h"
26 #include "common/rect.h"
27 #include "common/str.h"
28 
29 #include "engines/stark/resources/object.h"
30 #include "engines/stark/gfx/color.h"
31 
32 namespace Stark {
33 
34 class Visual;
35 class VisualImageXMG;
36 class VisualText;
37 namespace Formats {
38 class XRCReadStream;
39 }
40 
41 namespace Resources {
42 
46 class Image : public Object {
47 public:
48  static const Type::ResourceType TYPE = Type::kImage;
49 
50  enum SubType {
51  kImageSub2 = 2,
52  kImageSub3 = 3,
53  kImageText = 4
54  };
55 
57  static Object *construct(Object *parent, byte subType, uint16 index, const Common::String &name);
58 
60 
61  Image(Object *parent, byte subType, uint16 index, const Common::String &name);
62  virtual ~Image();
63 
64  // Resource API
65  void readData(Formats::XRCReadStream *stream) override;
66 
68  virtual Visual *getVisual();
69 
71  int indexForPoint(const Common::Point &point) const;
72 
74  Common::Point getHotspotPosition(uint index) const;
75 
76 protected:
77  void printData() override;
78  bool isPointInPolygon(const Polygon &polygon, const Common::Point &point) const;
79 
80  virtual void initVisual() = 0;
81 
82  Common::Path _filename;
83  Common::Path _archiveName;
84 
85  Visual *_visual;
86 
87  bool _transparent;
88  uint32 _transparentColor;
89  uint32 _field_44_ADF;
90  uint32 _field_48_ADF;
91 
92  Common::Point _hotspot;
93  Common::Array<Polygon> _polygons;
94 };
95 
99 class ImageStill : public Image {
100 public:
101  ImageStill(Object *parent, byte subType, uint16 index, const Common::String &name);
102  virtual ~ImageStill();
103 
104  // Resource API
105  void readData(Formats::XRCReadStream *stream) override;
106  void onPostRead() override;
107 
108 protected:
109  // Resource API
110  void printData() override;
111 
112  // Image API
113  void initVisual() override;
114 
115  bool loadPNGOverride(Stark::VisualImageXMG *visual) const;
116 
117  bool _noName;
118 };
119 
123 class ImageText : public Image {
124 public:
125  ImageText(Object *parent, byte subType, uint16 index, const Common::String &name);
126  virtual ~ImageText();
127 
128  // Resource API
129  void readData(Formats::XRCReadStream *stream) override;
130 
132  void resetVisual();
133 
134 protected:
135  // Resource API
136  void printData() override;
137 
138  // Image API
139  void initVisual() override;
140 
141  void fixWhiteCardinalHotspot(VisualText *text);
142 
143  Common::Point _size;
144  Common::String _text;
145  Gfx::Color _color;
146  uint32 _font;
147 };
148 
149 } // End of namespace Resources
150 } // End of namespace Stark
151 
152 #endif // STARK_RESOURCES_IMAGE_H
Definition: str.h:59
Definition: visual.h:29
Definition: path.h:52
Definition: image.h:99
Definition: text.h:44
Definition: console.h:27
Definition: object.h:143
Definition: rect.h:45
Definition: image.h:123
Definition: color.h:30
Definition: image.h:45
Definition: movie_decoder.h:32
Definition: xrc.h:45