Gnash
0.8.10
|
Base class for different types of bitmaps. More...
#include <GnashImage.h>
Public Types | |
typedef boost::uint8_t | value_type |
typedef boost::scoped_array < value_type > | container_type |
typedef value_type * | iterator |
typedef const value_type * | const_iterator |
Public Member Functions | |
virtual | ~GnashImage () |
ImageType | type () const |
Return the ImageType of the image. | |
ImageLocation | location () const |
Return the ImageLocation of the image. | |
size_t | size () const |
Get the size of the image buffer. | |
virtual size_t | stride () const |
Get the pitch of the image buffer. | |
size_t | channels () const |
Get the number of channels. | |
size_t | width () const |
Get the image's width. | |
size_t | height () const |
Get the image's width. | |
void | update (const_iterator data) |
Copy image data from a buffer. | |
void | update (const GnashImage &from) |
Copy image data from another image data. | |
virtual iterator | begin () |
Access the raw data. | |
virtual const_iterator | begin () const |
Access the raw data. | |
iterator | end () |
An iterator to the end of the data. | |
const_iterator | end () const |
An iterator to the end of the data. | |
Protected Member Functions | |
GnashImage (iterator data, size_t width, size_t height, ImageType type, ImageLocation location=GNASH_IMAGE_CPU) | |
Construct a GnashImage from a data buffer, taking ownership of the data. | |
GnashImage (size_t width, size_t height, ImageType type, ImageLocation location=GNASH_IMAGE_CPU) | |
Construct an empty GnashImage. | |
Protected Attributes | |
const ImageType | _type |
The type of the image: RGBA or RGB. | |
const ImageLocation | _location |
Image data location (CPU or GPU) | |
const size_t | _width |
Width of image, in pixels. | |
const size_t | _height |
Height of image, in pixels. | |
container_type | _data |
Data if held in this class. |
Base class for different types of bitmaps.
1. Bytes are packed in RGB(A) order. 2. Rowstride is equal to channels * width
typedef const value_type* gnash::image::GnashImage::const_iterator |
typedef boost::scoped_array<value_type> gnash::image::GnashImage::container_type |
typedef boost::uint8_t gnash::image::GnashImage::value_type |
virtual gnash::image::GnashImage::~GnashImage | ( | ) | [inline, virtual] |
gnash::image::GnashImage::GnashImage | ( | iterator | data, |
size_t | width, | ||
size_t | height, | ||
ImageType | type, | ||
ImageLocation | location = GNASH_IMAGE_CPU |
||
) | [protected] |
Construct a GnashImage from a data buffer, taking ownership of the data.
data | The raw image data. This class takes ownership. |
width | The width of the image in pixels. |
height | The height of the image in pixels. |
pitch | The pitch (rowstride) of the image in bytes. |
type | The ImageType of the image. |
gnash::image::GnashImage::GnashImage | ( | size_t | width, |
size_t | height, | ||
ImageType | type, | ||
ImageLocation | location = GNASH_IMAGE_CPU |
||
) | [protected] |
Construct an empty GnashImage.
Create an image allocating a buffer of height*pitch bytes.
Note: there is an arbitrary limit of boost::int32_t::max bytes for the total size of the bitmap constructed with this constructor.
width | The width of the image in pixels. |
height | The height of the image in pixels. |
type | The ImageType of the image. |
virtual iterator gnash::image::GnashImage::begin | ( | ) | [inline, virtual] |
Access the raw data.
Reimplemented in gnash::GnashVaapiImage, and gnash::media::gst::gnashGstBuffer.
References _data.
Referenced by update(), gnash::image::mergeAlpha(), gnash::image::Output::writeImageData(), gnash::image::scanline(), gnash::GnashVaapiImage::update(), gnash::image::begin(), gnash::renderer::openvg::OpenVGBitmap::OpenVGBitmap(), and gnash::renderer::openvg::OpenVGBitmap::applyPatternBitmap().
virtual const_iterator gnash::image::GnashImage::begin | ( | ) | const [inline, virtual] |
Access the raw data.
Reimplemented in gnash::GnashVaapiImage, and gnash::media::gst::gnashGstBuffer.
References _data.
size_t gnash::image::GnashImage::channels | ( | ) | const [inline] |
Get the number of channels.
References gnash::image::numChannels().
Referenced by gnash::media::gst::gnashGstBuffer::stride().
iterator gnash::image::GnashImage::end | ( | ) | [inline] |
An iterator to the end of the data.
References gnash::image::begin().
Referenced by gnash::image::end().
const_iterator gnash::image::GnashImage::end | ( | ) | const [inline] |
An iterator to the end of the data.
References gnash::image::begin().
size_t gnash::image::GnashImage::height | ( | ) | const [inline] |
Get the image's width.
References _height.
Referenced by gnash::BitmapData_as::height(), gnash::image::Output::writeImageData(), gnash::image::scanline(), gnash::renderer::openvg::OpenVGBitmap::OpenVGBitmap(), gnash::renderer::openvg::OpenVGBitmap::applyPatternBitmap(), gnash::Renderer_cairo::drawVideoFrame(), and test_renderer().
ImageLocation gnash::image::GnashImage::location | ( | ) | const [inline] |
Return the ImageLocation of the image.
This saves guessing when dynamic_cast is used.
Referenced by gnash::GnashVaapiImage::update().
size_t gnash::image::GnashImage::size | ( | ) | const [inline] |
Get the size of the image buffer.
References _height.
Referenced by GnashImage(), update(), gnash::image::mergeAlpha(), and gnash::GnashVaapiImage::update().
virtual size_t gnash::image::GnashImage::stride | ( | ) | const [inline, virtual] |
Get the pitch of the image buffer.
Reimplemented in gnash::media::gst::gnashGstBuffer.
References _width.
Referenced by gnash::image::scanline(), gnash::GnashVaapiImage::update(), gnash::renderer::openvg::OpenVGBitmap::OpenVGBitmap(), and gnash::renderer::openvg::OpenVGBitmap::applyPatternBitmap().
ImageType gnash::image::GnashImage::type | ( | ) | const [inline] |
Return the ImageType of the image.
This saves guessing when dynamic_cast is used.
Referenced by gnash::image::Output::writeImageData(), gnash::GnashVaapiImage::update(), gnash::image::begin(), gnash::image::end(), gnash::renderer::openvg::OpenVGBitmap::OpenVGBitmap(), gnash::renderer::openvg::OpenVGBitmap::applyPatternBitmap(), and gnash::Renderer_cairo::drawVideoFrame().
void gnash::image::GnashImage::update | ( | const_iterator | data | ) |
Copy image data from a buffer.
Note that this buffer MUST have the same rowstride and type, or unexpected things will happen. In general, it is only safe to copy from another GnashImage or unexpected things will happen.
data | buffer to copy data from. |
void gnash::image::GnashImage::update | ( | const GnashImage & | from | ) |
size_t gnash::image::GnashImage::width | ( | ) | const [inline] |
Get the image's width.
References _width.
Referenced by gnash::BitmapData_as::width(), update(), gnash::image::Output::writeImageData(), gnash::renderer::openvg::OpenVGBitmap::OpenVGBitmap(), gnash::renderer::openvg::OpenVGBitmap::applyPatternBitmap(), gnash::Renderer_cairo::drawVideoFrame(), test_renderer(), and gnash::media::gst::gnashGstBuffer::stride().
container_type gnash::image::GnashImage::_data [protected] |
Data if held in this class.
Referenced by GnashImage(), update(), and gnash::GnashVaapiImage::begin().
const size_t gnash::image::GnashImage::_height [protected] |
Height of image, in pixels.
Referenced by gnash::image::ImageRGBA::setPixel(), and gnash::GnashVaapiImage::GnashVaapiImage().
const ImageLocation gnash::image::GnashImage::_location [protected] |
Image data location (CPU or GPU)
Referenced by update().
const ImageType gnash::image::GnashImage::_type [protected] |
The type of the image: RGBA or RGB.
Referenced by update().
const size_t gnash::image::GnashImage::_width [protected] |
Width of image, in pixels.
Referenced by gnash::image::ImageRGBA::setPixel(), and gnash::GnashVaapiImage::GnashVaapiImage().