Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GNASH_ASOBJ_BITMAPDATA_H
00022 #define GNASH_ASOBJ_BITMAPDATA_H
00023
00024 #include <list>
00025 #include <boost/cstdint.hpp>
00026 #include <boost/scoped_ptr.hpp>
00027 #include <cassert>
00028 #include "smart_ptr.h"
00029 #include <boost/intrusive_ptr.hpp>
00030 #include <memory>
00031
00032 #include "Relay.h"
00033 #include "CachedBitmap.h"
00034 #include "GnashImage.h"
00035
00036 namespace gnash {
00037 class as_object;
00038 struct ObjectURI;
00039 class DisplayObject;
00040 class GnashImage;
00041 }
00042
00043 namespace gnash {
00044
00046
00049 class BitmapData_as : public Relay
00050 {
00051
00052 public:
00053
00055
00058 BitmapData_as(as_object* owner, std::auto_ptr<GnashImage> im,
00059 boost::uint32_t fillColor);
00060
00061 virtual ~BitmapData_as() {}
00062
00064
00066 size_t width() const {
00067 assert(data());
00068 return data()->width();
00069 }
00070
00072
00074 size_t height() const {
00075 assert(data());
00076 return data()->height();
00077 }
00078
00079 bool transparent() const {
00080 assert(data());
00081 return (data()->type() == GNASH_IMAGE_RGBA);
00082 }
00083
00084 const CachedBitmap* bitmapInfo() const {
00085 return _cachedBitmap.get();
00086 }
00087
00089
00091 void setPixel(size_t x, size_t y, boost::uint32_t color);
00092
00094 void setPixel32(size_t x, size_t y, boost::uint32_t color);
00095
00097
00099 boost::uint32_t getPixel(size_t x, size_t y) const;
00100
00102
00104 void fillRect(int x, int y, int w, int h, boost::uint32_t color);
00105
00107 void dispose();
00108
00110
00112 void attach(DisplayObject* obj) {
00113 _attachedObjects.push_back(obj);
00114 }
00115
00117 virtual void setReachable();
00118
00120 bool disposed() const {
00121 return !data();
00122 }
00123
00124 private:
00125
00126 GnashImage* data() const {
00127 return _cachedBitmap.get() ? &_cachedBitmap->image() : _image.get();
00128 }
00129
00131 void updateObjects();
00132
00134 as_object* _owner;
00135
00136 boost::intrusive_ptr<CachedBitmap> _cachedBitmap;
00137
00138 boost::scoped_ptr<GnashImage> _image;
00139
00140 std::list<DisplayObject*> _attachedObjects;
00141
00142 };
00143
00145 void bitmapdata_class_init(as_object& where, const ObjectURI& uri);
00146
00147 }
00148
00149 #endif