Public Types | Public Member Functions | Protected Member Functions | Protected Attributes

gnash::GnashImage Class Reference

Base class for different types of bitmaps. More...

#include <GnashImage.h>

Inheritance diagram for gnash::GnashImage:
gnash::GnashVaapiImage gnash::ImageRGB gnash::ImageRGBA gnash::media::gst::gnashGstBuffer

List of all members.

Public Types

typedef boost::uint8_t value_type
typedef boost::scoped_array
< value_type
container_type
typedef value_typeiterator
typedef const value_typeconst_iterator
typedef pixel_iterator
< iterator, ARGB< iterator > > 
argb_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.
argb_iterator argb_begin ()
 An iterator to write data in ARGB format to the bitmap.
argb_iterator argb_end ()
 An argb_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.

Detailed Description

Base class for different types of bitmaps.

1. Bytes are packed in RGB(A) order. 2. Rowstride is equal to channels * width


Member Typedef Documentation

typedef boost::scoped_array<value_type> gnash::GnashImage::container_type
typedef boost::uint8_t gnash::GnashImage::value_type

Constructor & Destructor Documentation

virtual gnash::GnashImage::~GnashImage (  )  [inline, virtual]
gnash::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.

Parameters:
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::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.

Parameters:
width The width of the image in pixels.
height The height of the image in pixels.
type The ImageType of the image.

Member Function Documentation

argb_iterator gnash::GnashImage::argb_begin (  )  [inline]

An iterator to write data in ARGB format to the bitmap.

References gnash::image::begin().

Referenced by gnash::BitmapData_as::getPixel().

argb_iterator gnash::GnashImage::argb_end (  )  [inline]

An argb_iterator to the end of the data.

References s2x::end.

virtual const_iterator gnash::GnashImage::begin (  )  const [inline, virtual]
virtual iterator gnash::GnashImage::begin (  )  [inline, virtual]
size_t gnash::GnashImage::channels (  )  const [inline]

Get the number of channels.

Returns:
The number of channels

References gnash::numChannels().

Referenced by gnash::media::gst::gnashGstBuffer::stride().

const_iterator gnash::GnashImage::end (  )  const [inline]

An iterator to the end of the data.

References gnash::image::begin().

iterator gnash::GnashImage::end (  )  [inline]

An iterator to the end of the data.

References gnash::image::begin().

size_t gnash::GnashImage::height (  )  const [inline]

Get the image's width.

Returns:
The image's height in pixels.

References _height.

Referenced by gnash::BitmapData_as::height(), and gnash::scanline().

ImageLocation gnash::GnashImage::location (  )  const [inline]

Return the ImageLocation of the image.

This saves guessing when dynamic_cast is used.

size_t gnash::GnashImage::size (  )  const [inline]

Get the size of the image buffer.

Returns:
The size of the buffer in bytes

References _height.

virtual size_t gnash::GnashImage::stride (  )  const [inline, virtual]

Get the pitch of the image buffer.

Returns:
The rowstride of the buffer in bytes

Reimplemented in gnash::media::gst::gnashGstBuffer, and gnash::media::gst::gnashGstBuffer.

References _width.

Referenced by gnash::scanline().

ImageType gnash::GnashImage::type (  )  const [inline]

Return the ImageType of the image.

This saves guessing when dynamic_cast is used.

void gnash::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.

Parameters:
data buffer to copy data from.
void gnash::GnashImage::update ( const GnashImage from  ) 

Copy image data from another image data.

Note that this buffer must have the same rowstride and type

Parameters:
from image to copy data from.

Reimplemented in gnash::GnashVaapiImage.

size_t gnash::GnashImage::width (  )  const [inline]

Get the image's width.

Returns:
The image's width in pixels.

References _width.

Referenced by gnash::media::gst::gnashGstBuffer::stride(), and gnash::BitmapData_as::width().


Member Data Documentation

Data if held in this class.

Referenced by gnash::GnashVaapiImage::begin().

const size_t gnash::GnashImage::_height [protected]

Height of image, in pixels.

Image data location (CPU or GPU).

The type of the image: RGBA or RGB.

const size_t gnash::GnashImage::_width [protected]

Width of image, in pixels.


The documentation for this class was generated from the following files: