Gnash
0.8.11dev
|
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::unique_ptr< image::GnashImage > im) | |
Construct a BitmapData. More... | |
virtual | ~BitmapData_as () |
size_t | width () const |
Return the width of the image. More... | |
size_t | height () const |
Return the height of the image. More... | |
bool | transparent () const |
Whether the BitmapData_as has transparency. More... | |
const CachedBitmap * | bitmapInfo () const |
Return the image data. More... | |
void | dispose () |
Free the bitmap data. More... | |
void | draw (MovieClip &mc, const Transform &transform) |
Draw a MovieClip to a BitmapData. More... | |
void | attach (DisplayObject *obj) |
Attach this BitmapData to an object. More... | |
virtual void | setReachable () |
Overrides Relay::setReachable(). More... | |
bool | disposed () const |
Whether the BitmapData has been disposed. More... | |
iterator | begin () const |
Return a BitmapData_as::iterator to the first pixel in the data. More... | |
iterator | end () const |
Return a BitmapData_as::iterator to a one-past-the end pixel. More... | |
void | updateObjects () const |
Inform any attached objects that the data has changed. More... | |
![]() | |
virtual | ~Relay ()=0 |
virtual void | clean () |
Handle any cleanup necessary before the Relay is destroyed. More... | |
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::unique_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 gnash::getRunResources(), gnash::key::r, and gnash::RunResources::renderer().
Referenced by gnash::registerBitmapDataNative().
|
inlinevirtual |
|
inline |
Attach this BitmapData to an object.
This may be either as a fill or an attached Bitmap.
Referenced by gnash::Bitmap::construct().
|
inline |
Return a BitmapData_as::iterator to the first pixel in the data.
References data.
Referenced by gnash::registerBitmapDataNative().
|
inline |
void gnash::BitmapData_as::dispose | ( | ) |
Free the bitmap data.
This potentially frees the data.
References updateObjects().
Referenced by gnash::registerBitmapDataNative().
|
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.
References data.
Referenced by draw(), gnash::registerBitmapDataNative(), and gnash::Bitmap::update().
Draw a MovieClip to a BitmapData.
References disposed(), gnash::MovieClip::draw(), gnash::getRunResources(), gnash::log_debug(), gnash::RunResources::renderer(), gnash::Renderer::Internal::renderer(), and updateObjects().
Referenced by gnash::registerBitmapDataNative().
|
inline |
Return a BitmapData_as::iterator to a one-past-the end pixel.
References data.
Referenced by gnash::registerBitmapDataNative().
|
inline |
Return the height of the image.
Do not call if disposed!
References data.
Referenced by gnash::registerBitmapDataNative().
|
virtual |
Overrides Relay::setReachable().
Reimplemented from gnash::Relay.
References gnash::renderer::opengl::for_each(), and gnash::GcResource::setReachable().
Referenced by gnash::Bitmap::markReachableObjects().
|
inline |
Whether the BitmapData_as has transparency.
Do not call if disposed!
References data, and gnash::image::TYPE_RGBA.
Referenced by gnash::registerBitmapDataNative().
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().
Referenced by dispose(), draw(), and gnash::registerBitmapDataNative().
|
inline |
Return the width of the image.
Do not call if disposed!
References data.
Referenced by gnash::registerBitmapDataNative().