Gnash
0.8.11dev
|
Class for reading JPEG image data. More...
#include <GnashImageJpeg.h>
Public Member Functions | |
DSOEXPORT | JpegInput (boost::shared_ptr< IOChannel > in) |
Construct a JpegInput object to read from an IOChannel. | |
void DSOEXPORT | readHeader (unsigned int maxHeaderBytes) |
Read the JPEG header information only. | |
~JpegInput () | |
void | read () |
Begin processing the image data. | |
DSOEXPORT void | discardPartialBuffer () |
Discard any data sitting in our input buffer. | |
void | finishImage () |
Complete processing the image and clean up. | |
size_t | getHeight () const |
Get the image's height in pixels. | |
size_t | getWidth () const |
Get the image's width in pixels. | |
size_t | getComponents () const |
Get number of components (channels) | |
void | readScanline (unsigned char *rgbData) |
Read a scanline's worth of image data into the given buffer. | |
void | errorOccurred (const char *msg) |
This function is called when libjpeg encounters an error. | |
![]() | |
Input (boost::shared_ptr< IOChannel > in) | |
Construct an Input object to read from an IOChannel. | |
virtual | ~Input () |
ImageType | imageType () |
Get the ImageType of the image. |
Static Public Member Functions | |
static std::auto_ptr< Input > | create (boost::shared_ptr< IOChannel > in) |
Create a JpegInput and transfer ownership to the caller. | |
static DSOEXPORT std::auto_ptr < GnashImage > | readSWFJpeg2WithTables (JpegInput &loader) |
For reading SWF JPEG2-style image data, using pre-loaded headers stored in the given JpegInput object. | |
static std::auto_ptr< JpegInput > | createSWFJpeg2HeaderOnly (boost::shared_ptr< IOChannel > in, unsigned int maxHeaderBytes) |
Create a JPEG 'loader' object by reading a JPEG header. | |
![]() | |
static DSOEXPORT std::auto_ptr < ImageRGBA > | readSWFJpeg3 (boost::shared_ptr< gnash::IOChannel > in) |
For reading SWF JPEG3-style image data, like ordinary JPEG, but stores the data in ImageRGBA format. | |
static DSOEXPORT std::auto_ptr < GnashImage > | readImageData (boost::shared_ptr< gnash::IOChannel > in, FileType type) |
Read image data from an IOChannel into an GnashImage. |
Additional Inherited Members | |
![]() | |
boost::shared_ptr< IOChannel > | _inStream |
ImageType | _type |
Class for reading JPEG image data.
This uses the IJG jpeglib to implement the Input interface.
gnash::image::JpegInput::JpegInput | ( | boost::shared_ptr< IOChannel > | in | ) |
Construct a JpegInput object to read from an IOChannel.
in | The stream to read JPEG data from. Ownership is shared between caller and JpegInput, so it is freed automatically when the last owner is destroyed. |
Referenced by create(), and createSWFJpeg2HeaderOnly().
gnash::image::JpegInput::~JpegInput | ( | ) |
|
inlinestatic |
Create a JpegInput and transfer ownership to the caller.
in | The IOChannel to read JPEG data from. |
References JpegInput().
Referenced by gnash::image::Input::readImageData().
|
inlinestatic |
Create a JPEG 'loader' object by reading a JPEG header.
This is for reusing the header information for different JPEGs images.
in | The channel to read JPEG header data from. |
maxHeaderBytes | The maximum number of bytes to read. |
References JpegInput().
Referenced by gnash::SWF::jpeg_tables_loader(), and gnash::image::Input::readSWFJpeg3().
void gnash::image::JpegInput::discardPartialBuffer | ( | ) |
Discard any data sitting in our input buffer.
Use this before/after reading headers or partial image data, to avoid screwing up future reads.
void gnash::image::JpegInput::errorOccurred | ( | const char * | msg | ) |
This function is called when libjpeg encounters an error.
It is needed to avoid memory corruption during stack unwinding by freeing libjpeg resources correctly before throwing an exception.
msg | An error message for logging. |
void gnash::image::JpegInput::finishImage | ( | ) |
Complete processing the image and clean up.
This should close / free all resources from libjpeg.
References _.
Referenced by readSWFJpeg2WithTables().
|
virtual |
Get number of components (channels)
Implements gnash::image::Input.
Referenced by read().
|
virtual |
Get the image's height in pixels.
Implements gnash::image::Input.
Referenced by readSWFJpeg2WithTables().
|
virtual |
Get the image's width in pixels.
Implements gnash::image::Input.
Referenced by readScanline(), and readSWFJpeg2WithTables().
|
virtual |
Begin processing the image data.
Implements gnash::image::Input.
References _, gnash::image::Input::_type, getComponents(), gnash::image::TYPE_RGB, and gnash::image::TYPE_RGBA.
Referenced by readSWFJpeg2WithTables().
void gnash::image::JpegInput::readHeader | ( | unsigned int | maxHeaderBytes | ) |
Read the JPEG header information only.
maxHeaderBytes | The maximum number of bytes to read before Stopping. If the header is shorter, we stop early. |
References _.
|
virtual |
Read a scanline's worth of image data into the given buffer.
The amount of data read is getWidth() * getComponents().
rgbData | The buffer for writing raw RGB data to. |
Implements gnash::image::Input.
References getWidth(), and test::w.
Referenced by readSWFJpeg2WithTables().
|
static |
For reading SWF JPEG2-style image data, using pre-loaded headers stored in the given JpegInput object.
loader | The JpegInput object to use for reading the data. This should have been constructed with createSWFJpeg2HeaderOnly(). |
References finishImage(), getHeight(), getWidth(), height, read(), readScanline(), gnash::image::scanline(), and y.