Page Speed Optimization Libraries
1.13.35.1
|
#include "image_frame_interface.h"
Public Member Functions | |
MultipleFrameReader (MessageHandler *handler) | |
virtual ScanlineStatus | Reset ()=0 |
Resets the MultipleFrameReader to its initial state. | |
virtual ScanlineStatus | Initialize ()=0 |
ScanlineStatus | Initialize (const void *image_buffer, size_t buffer_length) |
virtual bool | HasMoreFrames () const =0 |
virtual bool | HasMoreScanlines () const =0 |
virtual ScanlineStatus | PrepareNextFrame ()=0 |
virtual ScanlineStatus | ReadNextScanline (const void **out_scanline_bytes)=0 |
virtual ScanlineStatus | GetFrameSpec (FrameSpec *frame_spec) const =0 |
virtual ScanlineStatus | GetImageSpec (ImageSpec *image_spec) const =0 |
MessageHandler * | message_handler () const |
virtual ScanlineStatus | set_quirks_mode (QuirksMode quirks_mode) |
virtual QuirksMode | quirks_mode () const |
bool | Reset (ScanlineStatus *status) |
bool | Initialize (const void *image_buffer, size_t buffer_length, ScanlineStatus *status) |
bool | Initialize (ScanlineStatus *status) |
bool | PrepareNextFrame (ScanlineStatus *status) |
bool | ReadNextScanline (const void **out_scanline_bytes, ScanlineStatus *status) |
bool | GetFrameSpec (FrameSpec *frame_spec, ScanlineStatus *status) |
bool | GetImageSpec (ImageSpec *image_spec, ScanlineStatus *status) |
bool | set_quirks_mode (QuirksMode quirks_mode, ScanlineStatus *status) |
Protected Attributes | |
const void * | image_buffer_ |
size_t | buffer_length_ |
Interface for reading both animated and static images.
Typical usage of this API is as follows:
Initialize() GetImageSpec() // optional while (HasMoreFrames()) { PrepareNextFrame() GetFrameSpec() // optional while (HasMoreScanlines()) { ReadNextScanline() } }
The "optional" lines above are not necessary for just reading an image. You might want to call them, though, if the metadata they contain is of interest, or if you're passing the read image to a MultipleFrameWriter, which needs the metadata in ImageSpec and FrameSpec (see below).
|
pure virtual |
Assigns to '*frame_spec' the FrameSpec describing the current frame.
Implemented in pagespeed::image_compression::ScanlineToFrameReaderAdapter, pagespeed::image_compression::GifFrameReader, and pagespeed::image_compression::MultipleFramePaddingReader.
|
pure virtual |
Copies into '*image_spec' the ImageSpec describing the image.
Implemented in pagespeed::image_compression::GifFrameReader, pagespeed::image_compression::ScanlineToFrameReaderAdapter, and pagespeed::image_compression::MultipleFramePaddingReader.
|
pure virtual |
Returns true iff the image being read has additional frames beyond the current frame being read. For any well-formed image with at least one frame (or for a well-formed static image), this will return true before the first call to PrepareNextFrame().
Implemented in pagespeed::image_compression::ScanlineToFrameReaderAdapter, pagespeed::image_compression::GifFrameReader, and pagespeed::image_compression::MultipleFramePaddingReader.
|
pure virtual |
Returns true iff the current frame has more scanlines that have not yet been read.
Implemented in pagespeed::image_compression::ScanlineToFrameReaderAdapter, pagespeed::image_compression::GifFrameReader, and pagespeed::image_compression::MultipleFramePaddingReader.
|
pure virtual |
Initializes MultipleFrameReader to read image data of length 'buffer_length_' from 'image_buffer_'. This function should take care of calling Reset() if necessary, so that the sequence "Reset(); Initialize();" is never needed.
Implemented in pagespeed::image_compression::ScanlineToFrameReaderAdapter, pagespeed::image_compression::GifFrameReader, and pagespeed::image_compression::MultipleFramePaddingReader.
|
inline |
Sets 'buffer_length_' and 'image_buffer_' and calls Initialize(). Do not override this function; override the no-arg overload instead.
|
inline |
The message handler used by this class. Neither the caller nor this class have ownership.
|
pure virtual |
Prepares to read scanlines from the frame after the current one. Must be called before reading from the first frame.
Implemented in pagespeed::image_compression::ScanlineToFrameReaderAdapter, pagespeed::image_compression::GifFrameReader, and pagespeed::image_compression::MultipleFramePaddingReader.
|
pure virtual |
Reads the next available scanline in the current frame and copies a pointer to it into '*out_scanline_bytes'. This class retains ownership of the read scanline. The scanline encodes as many pixels as the width of the current frame, which is not necessarily the width of the whole image.
Implemented in pagespeed::image_compression::ScanlineToFrameReaderAdapter, pagespeed::image_compression::GifFrameReader, and pagespeed::image_compression::MultipleFramePaddingReader.
|
inline |
Convenience forms of the methods above. If 'status' indicates an error on entry, each of these methods does nothing and returns false. Otherwise, it calls the corresponding method above, updates 'status', and returns true iff the call succeeded.