Gnash  0.8.11dev
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
gnash::image::Input Class Referenceabstract

The base class for reading image data. More...

#include <GnashImage.h>

Inheritance diagram for gnash::image::Input:
gnash::image::JpegInput

Public Member Functions

 Input (std::shared_ptr< IOChannel > in)
 Construct an Input object to read from an IOChannel. More...
 
virtual ~Input ()
 
virtual void read ()=0
 Begin processing the image data. More...
 
virtual size_t getHeight () const =0
 Get the image's height in pixels. More...
 
virtual size_t getWidth () const =0
 Get the image's width in pixels. More...
 
virtual size_t getComponents () const =0
 Get number of components (channels) More...
 
virtual void readScanline (unsigned char *rgbData)=0
 Read a scanline's worth of image data into the given buffer. More...
 
ImageType imageType ()
 Get the ImageType of the image. More...
 

Static Public Member Functions

static DSOEXPORT std::unique_ptr< ImageRGBAreadSWFJpeg3 (std::shared_ptr< gnash::IOChannel > in)
 For reading SWF JPEG3-style image data, like ordinary JPEG, but stores the data in ImageRGBA format. More...
 
static DSOEXPORT std::unique_ptr< GnashImagereadImageData (std::shared_ptr< gnash::IOChannel > in, FileType type)
 Read image data from an IOChannel into an GnashImage. More...
 

Protected Attributes

std::shared_ptr< IOChannel_inStream
 
ImageType _type
 

Detailed Description

The base class for reading image data.

Constructor & Destructor Documentation

§ Input()

gnash::image::Input::Input ( std::shared_ptr< IOChannel in)
inline

Construct an Input object to read from an IOChannel.

Parameters
inThe stream to read data from. Ownership is shared between caller and Input, so it is freed automatically when the last owner is destroyed.

§ ~Input()

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

References gnash::getHeight().

Member Function Documentation

§ getComponents()

virtual size_t gnash::image::Input::getComponents ( ) const
pure virtual

Get number of components (channels)

Returns
The number of components, e.g. 3 for RGB

Implemented in gnash::image::JpegInput.

§ getHeight()

virtual size_t gnash::image::Input::getHeight ( ) const
pure virtual

Get the image's height in pixels.

Returns
The height of the image in pixels.

Implemented in gnash::image::JpegInput.

§ getWidth()

virtual size_t gnash::image::Input::getWidth ( ) const
pure virtual

Get the image's width in pixels.

Returns
The width of the image in pixels.

Implemented in gnash::image::JpegInput.

§ imageType()

ImageType gnash::image::Input::imageType ( )
inline

Get the ImageType of the image.

Returns
The type of the image. This is GNASH_IMAGE_INVALID at least until read() has been called and reads some valid data.

References DSOEXPORT.

§ read()

virtual void gnash::image::Input::read ( )
pure virtual

Begin processing the image data.

Implemented in gnash::image::JpegInput.

§ readImageData()

std::unique_ptr< GnashImage > gnash::image::Input::readImageData ( std::shared_ptr< gnash::IOChannel in,
FileType  type 
)
static

Read image data from an IOChannel into an GnashImage.

Parameters
inThe IOChannel to read the image from.
typeThe type of image to read.
Returns
An GnashImage with the read image data. If type is an unsupported FileType or image reading fails, a NULL unique_ptr is returned.

References _, gnash::image::JpegInput::create(), gnash::image::createGifInput(), gnash::image::createPngInput(), gnash::key::e, gnash::GNASH_FILETYPE_GIF, gnash::GNASH_FILETYPE_JPEG, gnash::GNASH_FILETYPE_PNG, gnash::image::GnashImage::height(), gnash::key::i, gnash::image::ImageRGBA::ImageRGBA(), gnash::log_error(), gnash::image::scanline(), gnash::image::TYPE_RGB, and gnash::image::TYPE_RGBA.

Referenced by gnash::MovieFactory::clear(), and gnash::SWF::DefineBitsTag::loader().

§ readScanline()

virtual void gnash::image::Input::readScanline ( unsigned char *  rgbData)
pure virtual

Read a scanline's worth of image data into the given buffer.

Parameters
rgbDataThe buffer for writing raw RGB data to.

Implemented in gnash::image::JpegInput.

§ readSWFJpeg3()

std::unique_ptr< ImageRGBA > gnash::image::Input::readSWFJpeg3 ( std::shared_ptr< gnash::IOChannel in)
static

Member Data Documentation

§ _inStream

std::shared_ptr<IOChannel> gnash::image::Input::_inStream
protected

§ _type

ImageType gnash::image::Input::_type
protected

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