|
Gnash
0.8.11dev
|
Class for reading JPEG image data. More...
#include <GnashImageJpeg.h>
Public Member Functions | |
| DSOEXPORT | JpegInput (std::shared_ptr< IOChannel > in) |
| Construct a JpegInput object to read from an IOChannel. More... | |
| void DSOEXPORT | readHeader (unsigned int maxHeaderBytes) |
| Read the JPEG header information only. More... | |
| ~JpegInput () | |
| void | read () |
| Begin processing the image data. More... | |
| DSOEXPORT void | discardPartialBuffer () |
| Discard any data sitting in our input buffer. More... | |
| void | finishImage () |
| Complete processing the image and clean up. More... | |
| size_t | getHeight () const |
| Get the image's height in pixels. More... | |
| size_t | getWidth () const |
| Get the image's width in pixels. More... | |
| size_t | getComponents () const |
| Get number of components (channels) More... | |
| void | readScanline (unsigned char *rgbData) |
| Read a scanline's worth of image data into the given buffer. More... | |
| void | errorOccurred (const char *msg) |
| This function is called when libjpeg encounters an error. More... | |
Public Member Functions inherited from gnash::image::Input | |
| Input (std::shared_ptr< IOChannel > in) | |
| Construct an Input object to read from an IOChannel. More... | |
| virtual | ~Input () |
| ImageType | imageType () |
| Get the ImageType of the image. More... | |
Static Public Member Functions | |
| static std::unique_ptr< Input > | create (std::shared_ptr< IOChannel > in) |
| Create a JpegInput and transfer ownership to the caller. More... | |
| static DSOEXPORT std::unique_ptr< GnashImage > | readSWFJpeg2WithTables (JpegInput &loader) |
| For reading SWF JPEG2-style image data, using pre-loaded headers stored in the given JpegInput object. More... | |
| static std::unique_ptr< JpegInput > | createSWFJpeg2HeaderOnly (std::shared_ptr< IOChannel > in, unsigned int maxHeaderBytes) |
| Create a JPEG 'loader' object by reading a JPEG header. More... | |
Static Public Member Functions inherited from gnash::image::Input | |
| static DSOEXPORT std::unique_ptr< ImageRGBA > | readSWFJpeg3 (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< GnashImage > | readImageData (std::shared_ptr< gnash::IOChannel > in, FileType type) |
| Read image data from an IOChannel into an GnashImage. More... | |
Additional Inherited Members | |
Protected Attributes inherited from gnash::image::Input | |
| std::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 | ( | std::shared_ptr< IOChannel > | in | ) |
| gnash::image::JpegInput::~JpegInput | ( | ) |
|
inlinestatic |
Create a JpegInput and transfer ownership to the caller.
| in | The IOChannel to read JPEG data from. |
References DSOEXPORT.
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. |
Referenced by 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.
Referenced by gnash::SWF::DefineBitsTag::loader().
| 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. |
References gnash::log_error().
| 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::log_error(), 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 _, and gnash::log_error().
|
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.
Referenced by gnash::SWF::DefineBitsTag::loader().
1.8.12