aboutsummaryrefslogtreecommitdiff
path: root/common/image-map.cpp
diff options
context:
space:
mode:
authorStephen Kennedy2008-07-07 21:10:58 +0000
committerStephen Kennedy2008-07-07 21:10:58 +0000
commit641e3d752e9fc3b631474773a815b019f8d507e7 (patch)
treee9d477999b603e56787437cd56178294893ab856 /common/image-map.cpp
parent43c0fb8d895654394ac3a047947d15703a4557fa (diff)
downloadscummvm-rg350-641e3d752e9fc3b631474773a815b019f8d507e7.tar.gz
scummvm-rg350-641e3d752e9fc3b631474773a815b019f8d507e7.tar.bz2
scummvm-rg350-641e3d752e9fc3b631474773a815b019f8d507e7.zip
MILESTONE: bitmap showing with key color transparency implemented!
- SurfaceKeyColored class handles blitting of keycolor transparency data - ImageMap tested - Rect and Polygon areas seem to be working as expected svn-id: r32950
Diffstat (limited to 'common/image-map.cpp')
-rw-r--r--common/image-map.cpp49
1 files changed, 42 insertions, 7 deletions
diff --git a/common/image-map.cpp b/common/image-map.cpp
index 4e8df6cc50..54b4858dd5 100644
--- a/common/image-map.cpp
+++ b/common/image-map.cpp
@@ -27,6 +27,41 @@
namespace Common {
+ImageMap::~ImageMap() {
+ HashMap<String, Shape*>::iterator it;
+ for (it = _areas.begin(); it != _areas.end(); it++) {
+ delete it->_value;
+ }
+}
+
+Rect *ImageMap::createRectArea(const String& id) {
+ if (_areas.contains(id)) {
+ warning("Image map already contains an area with target of '%s'");
+ return 0;
+ }
+ Rect *r = new Rect();
+ _areas[id] = r;
+ return r;
+}
+
+Polygon *ImageMap::createPolygonArea(const String& id) {
+ if (_areas.contains(id)) {
+ warning("Image map already contains an area with target of '%s'");
+ return 0;
+ }
+ Polygon *p = new Polygon();
+ _areas[id] = p;
+ return p;
+}
+
+/*
+void ImageMap::addMapArea(Shape *shape, const String& target) {
+ if (_areas.contains(target)) {
+ warning("Image map already contains an area with target of '%s'");
+ return;
+ }
+ _areas[target] = shape;
+}
void ImageMap::addRectMapArea(const Rect& rect, const String& target) {
areas.push_back(MapArea(rect, target));
}
@@ -34,14 +69,14 @@ void ImageMap::addRectMapArea(const Rect& rect, const String& target) {
void ImageMap::addPolygonMapArea(const Polygon& poly, const String& target) {
areas.push_back(MapArea(poly, target));
}
-
-MapArea *ImageMap::findMapArea(int16 x, int16 y) {
- Array<MapArea>::iterator it;
- for (it = areas.begin(); it != areas.end(); it++) {
- if (it->contains(x, y))
- return it;
+*/
+String ImageMap::findMapArea(int16 x, int16 y) {
+ HashMap<String, Shape*>::iterator it;
+ for (it = _areas.begin(); it != _areas.end(); it++) {
+ if (it->_value->contains(x, y))
+ return it->_key;
}
- return 0;
+ return "";
}