Gnash  0.8.11dev
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gnash::image::GnashImage Class Reference

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

#include <GnashImage.h>

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

Public Types

typedef std::uint8_t value_type
 
typedef std::unique_ptr< value_type[]> container_type
 
typedef value_typeiterator
 
typedef const value_typeconst_iterator
 

Public Member Functions

virtual ~GnashImage ()
 
ImageType type () const
 Return the ImageType of the image. More...
 
ImageLocation location () const
 Return the ImageLocation of the image. More...
 
size_t size () const
 Get the size of the image buffer. More...
 
virtual size_t stride () const
 Get the pitch of the image buffer. More...
 
size_t channels () const
 Get the number of channels. More...
 
size_t width () const
 Get the image's width. More...
 
size_t height () const
 Get the image's width. More...
 
void update (const_iterator data)
 Copy image data from a buffer. More...
 
void update (const GnashImage &from)
 Copy image data from another image data. More...
 
virtual iterator begin ()
 Access the raw data. More...
 
virtual const_iterator begin () const
 Access the raw data. More...
 
iterator end ()
 An iterator to the end of the data. More...
 
const_iterator end () const
 An iterator to the end of the data. More...
 

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. More...
 
 GnashImage (size_t width, size_t height, ImageType type, ImageLocation location=GNASH_IMAGE_CPU)
 Construct an empty GnashImage. More...
 

Protected Attributes

const ImageType _type
 The type of the image: RGBA or RGB. More...
 
const ImageLocation _location
 Image data location (CPU or GPU) More...
 
const size_t _width
 Width of image, in pixels. More...
 
const size_t _height
 Height of image, in pixels. More...
 
container_type _data
 Data if held in this class. More...
 

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

§ const_iterator

§ container_type

§ iterator

§ value_type

Constructor & Destructor Documentation

§ ~GnashImage()

virtual gnash::image::GnashImage::~GnashImage ( )
inlinevirtual

§ GnashImage() [1/2]

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.

Parameters
dataThe raw image data. This class takes ownership.
widthThe width of the image in pixels.
heightThe height of the image in pixels.
pitchThe pitch (rowstride) of the image in bytes.
typeThe ImageType of the image.

§ GnashImage() [2/2]

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 std::int32_t::max bytes for the total size of the bitmap constructed with this constructor.

Parameters
widthThe width of the image in pixels.
heightThe height of the image in pixels.
typeThe ImageType of the image.

References _data, _height, _width, channels(), and size().

Member Function Documentation

§ begin() [1/2]

virtual iterator gnash::image::GnashImage::begin ( )
inlinevirtual

§ begin() [2/2]

virtual const_iterator gnash::image::GnashImage::begin ( ) const
inlinevirtual

Access the raw data.

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

§ channels()

size_t gnash::image::GnashImage::channels ( ) const
inline

Get the number of channels.

Returns
The number of channels

References gnash::image::numChannels().

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

§ end() [1/2]

iterator gnash::image::GnashImage::end ( )
inline

An iterator to the end of the data.

References gnash::image::begin().

Referenced by gnash::image::end().

§ end() [2/2]

const_iterator gnash::image::GnashImage::end ( ) const
inline

An iterator to the end of the data.

References gnash::image::begin(), gnash::image::GNASH_IMAGE_CPU, height, and width.

§ height()

size_t gnash::image::GnashImage::height ( ) const
inline

§ location()

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()

size_t gnash::image::GnashImage::size ( ) const
inline

Get the size of the image buffer.

Returns
The size of the buffer in bytes

Referenced by GnashImage(), gnash::image::mergeAlpha(), gnash::GnashVaapiImage::update(), and update().

§ stride()

virtual size_t gnash::image::GnashImage::stride ( ) const
inlinevirtual

§ type()

ImageType gnash::image::GnashImage::type ( ) const
inline

§ update() [1/2]

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.

Parameters
databuffer to copy data from.

References _data, and size().

§ update() [2/2]

void gnash::image::GnashImage::update ( const GnashImage from)

Copy image data from another image data.

Note that this buffer must have the same rowstride and type

Parameters
fromimage to copy data from.

References _location, _type, begin(), size(), and width().

§ width()

size_t gnash::image::GnashImage::width ( ) const
inline

Member Data Documentation

§ _data

container_type gnash::image::GnashImage::_data
protected

Data if held in this class.

Referenced by GnashImage(), gnash::GnashVaapiImage::update(), and update().

§ _height

const size_t gnash::image::GnashImage::_height
protected

Height of image, in pixels.

Referenced by GnashImage(), and gnash::image::ImageRGBA::setPixel().

§ _location

const ImageLocation gnash::image::GnashImage::_location
protected

Image data location (CPU or GPU)

Referenced by update().

§ _type

const ImageType gnash::image::GnashImage::_type
protected

The type of the image: RGBA or RGB.

Referenced by update().

§ _width

const size_t gnash::image::GnashImage::_width
protected

Width of image, in pixels.

Referenced by GnashImage(), and gnash::image::ImageRGBA::setPixel().


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