ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

image.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef STARK_RESOURCES_IMAGE_H
00024 #define STARK_RESOURCES_IMAGE_H
00025 
00026 #include "common/rect.h"
00027 #include "common/str.h"
00028 
00029 #include "engines/stark/resources/object.h"
00030 #include "engines/stark/visual/text.h"
00031 
00032 namespace Stark {
00033 
00034 class Visual;
00035 class VisualImageXMG;
00036 namespace Formats {
00037 class XRCReadStream;
00038 }
00039 
00040 namespace Resources {
00041 
00045 class Image : public Object {
00046 public:
00047     static const Type::ResourceType TYPE = Type::kImage;
00048 
00049     enum SubType {
00050         kImageSub2 = 2,
00051         kImageSub3 = 3,
00052         kImageText = 4
00053     };
00054 
00056     static Object *construct(Object *parent, byte subType, uint16 index, const Common::String &name);
00057 
00058     typedef Common::Array<Common::Point> Polygon;
00059 
00060     Image(Object *parent, byte subType, uint16 index, const Common::String &name);
00061     virtual ~Image();
00062 
00063     // Resource API
00064     void readData(Formats::XRCReadStream *stream) override;
00065 
00067     virtual Visual *getVisual();
00068 
00070     int indexForPoint(const Common::Point &point) const;
00071 
00073     Common::Point getHotspotPosition(uint index) const;
00074 
00075 protected:
00076     void printData() override;
00077     bool isPointInPolygon(const Polygon &polygon, const Common::Point &point) const;
00078 
00079     virtual void initVisual() = 0;
00080 
00081     Common::String _filename;
00082     Common::String _archiveName;
00083 
00084     Visual *_visual;
00085 
00086     bool _transparent;
00087     uint32 _transparentColor;
00088     uint32 _field_44_ADF;
00089     uint32 _field_48_ADF;
00090 
00091     Common::Point _hotspot;
00092     Common::Array<Polygon> _polygons;
00093 };
00094 
00098 class ImageStill : public Image {
00099 public:
00100     ImageStill(Object *parent, byte subType, uint16 index, const Common::String &name);
00101     virtual ~ImageStill();
00102 
00103     // Resource API
00104     void readData(Formats::XRCReadStream *stream) override;
00105     void onPostRead() override;
00106 
00107 protected:
00108     // Resource API
00109     void printData() override;
00110 
00111     // Image API
00112     void initVisual() override;
00113 
00114     bool loadPNGOverride(Stark::VisualImageXMG *visual) const;
00115 
00116     bool _noName;
00117 };
00118 
00122 class ImageText : public Image {
00123 public:
00124     ImageText(Object *parent, byte subType, uint16 index, const Common::String &name);
00125     virtual ~ImageText();
00126 
00127     // Resource API
00128     void readData(Formats::XRCReadStream *stream) override;
00129 
00131     void resetVisual();
00132 
00133 protected:
00134     // Resource API
00135     void printData() override;
00136 
00137     // Image API
00138     void initVisual() override;
00139 
00140     void fixWhiteCardinalHotspot(VisualText *text);
00141 
00142     Common::Point _size;
00143     Common::String _text;
00144     Color _color;
00145     uint32 _font;
00146 };
00147 
00148 } // End of namespace Resources
00149 } // End of namespace Stark
00150 
00151 #endif // STARK_RESOURCES_IMAGE_H


Generated on Sat Jul 20 2019 05:00:57 for ResidualVM by doxygen 1.7.1
curved edge   curved edge