Gnash
0.8.10
|
Implements the BitmapData native type. More...
#include <BitmapData_as.h>
Public Types | |
enum | Channel { CHANNEL_RED = 1, CHANNEL_GREEN = 2, CHANNEL_BLUE = 4, CHANNEL_ALPHA = 8 } |
typedef image::pixel_iterator < image::ARGB > | iterator |
Public Member Functions | |
BitmapData_as (as_object *owner, std::auto_ptr< image::GnashImage > im) | |
Construct a BitmapData. | |
virtual | ~BitmapData_as () |
size_t | width () const |
Return the width of the image. | |
size_t | height () const |
Return the height of the image. | |
bool | transparent () const |
Whether the BitmapData_as has transparency. | |
const CachedBitmap * | bitmapInfo () const |
Return the image data. | |
void | dispose () |
Free the bitmap data. | |
void | draw (MovieClip &mc, const Transform &transform) |
Draw a MovieClip to a BitmapData. | |
void | attach (DisplayObject *obj) |
Attach this BitmapData to an object. | |
virtual void | setReachable () |
Overrides Relay::setReachable(). | |
bool | disposed () const |
Whether the BitmapData has been disposed. | |
iterator | begin () const |
Return a BitmapData_as::iterator to the first pixel in the data. | |
iterator | end () const |
Return a BitmapData_as::iterator to a one-past-the end pixel. | |
void | updateObjects () const |
Inform any attached objects that the data has changed. |
Implements the BitmapData native type.
This class gives access to a Bitmap that may be attached to a MovieClip and rendered directly. The underlying data may therefore be stored in a Renderer, for instance, and only retrieved from there when a BitmapData instance requires access to it. Because this retrieval can be expensive, it is advisable not to call member functions frequently, but rather to access the data through iterators. To facilitate this, iterators are random access. There is also overhead to calling functions such as width() and height(), again because the image data is retrieve from the Renderer. The size is immutable, so these dimensions can safely be cached.
gnash::BitmapData_as::BitmapData_as | ( | as_object * | owner, |
std::auto_ptr< image::GnashImage > | im | ||
) |
Construct a BitmapData.
The constructor sets the immutable size of the bitmap, as well as whether it can handle transparency or not.
References assert, gnash::key::r, gnash::getRunResources(), and gnash::RunResources::renderer().
virtual gnash::BitmapData_as::~BitmapData_as | ( | ) | [inline, virtual] |
void gnash::BitmapData_as::attach | ( | DisplayObject * | obj | ) | [inline] |
Attach this BitmapData to an object.
This may be either as a fill or an attached Bitmap.
Referenced by gnash::Bitmap::construct().
iterator gnash::BitmapData_as::begin | ( | ) | const [inline] |
Return a BitmapData_as::iterator to the first pixel in the data.
References assert, and disposed().
const CachedBitmap* gnash::BitmapData_as::bitmapInfo | ( | ) | const [inline] |
Return the image data.
This is only for use by containes
void gnash::BitmapData_as::dispose | ( | ) |
bool gnash::BitmapData_as::disposed | ( | ) | const [inline] |
Whether the BitmapData has been disposed.
Any callers requiring access to the data or any properties should check that this is false first. Particularly width(), height(), transparent(), begin(), end() may only be called if the BitmapData_as has not been disposed.
Referenced by gnash::Bitmap::Bitmap(), gnash::Bitmap::update(), draw(), begin(), and end().
Draw a MovieClip to a BitmapData.
References disposed(), gnash::getRunResources(), gnash::RunResources::renderer(), gnash::Renderer::Internal::renderer(), gnash::MovieClip::draw(), and updateObjects().
iterator gnash::BitmapData_as::end | ( | ) | const [inline] |
Return a BitmapData_as::iterator to a one-past-the end pixel.
References assert, and disposed().
size_t gnash::BitmapData_as::height | ( | ) | const [inline] |
Return the height of the image.
Do not call if disposed!
References assert, and gnash::image::GnashImage::height().
void gnash::BitmapData_as::setReachable | ( | ) | [virtual] |
Overrides Relay::setReachable().
Reimplemented from gnash::Relay.
References gnash::renderer::opengl::for_each(), and gnash::GcResource::setReachable().
Referenced by gnash::Bitmap::markReachableObjects().
bool gnash::BitmapData_as::transparent | ( | ) | const [inline] |
Whether the BitmapData_as has transparency.
Do not call if disposed!
References assert, and gnash::image::TYPE_RGBA.
void gnash::BitmapData_as::updateObjects | ( | ) | const |
Inform any attached objects that the data has changed.
References gnash::renderer::opengl::for_each(), and gnash::DisplayObject::update().
size_t gnash::BitmapData_as::width | ( | ) | const [inline] |
Return the width of the image.
Do not call if disposed!
References assert, and gnash::image::GnashImage::width().