Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
pagespeed::image_compression::MultipleFrameReader Class Referenceabstract

#include "image_frame_interface.h"

Inheritance diagram for pagespeed::image_compression::MultipleFrameReader:
pagespeed::image_compression::GifFrameReader pagespeed::image_compression::MultipleFramePaddingReader pagespeed::image_compression::ScanlineToFrameReaderAdapter

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
 
MessageHandlermessage_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_
 

Detailed Description

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

Member Function Documentation

virtual ScanlineStatus pagespeed::image_compression::MultipleFrameReader::GetFrameSpec ( FrameSpec frame_spec) const
pure virtual

Assigns to '*frame_spec' the FrameSpec describing the current frame.

Todo:
TODO(vchudnov): Consider simplifying this method to return frame_spec rather than the ScanlineStatus.

Implemented in pagespeed::image_compression::ScanlineToFrameReaderAdapter, pagespeed::image_compression::GifFrameReader, and pagespeed::image_compression::MultipleFramePaddingReader.

virtual ScanlineStatus pagespeed::image_compression::MultipleFrameReader::GetImageSpec ( ImageSpec image_spec) const
pure virtual
virtual bool pagespeed::image_compression::MultipleFrameReader::HasMoreFrames ( ) const
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.

virtual bool pagespeed::image_compression::MultipleFrameReader::HasMoreScanlines ( ) const
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.

virtual ScanlineStatus pagespeed::image_compression::MultipleFrameReader::Initialize ( )
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.

ScanlineStatus pagespeed::image_compression::MultipleFrameReader::Initialize ( const void *  image_buffer,
size_t  buffer_length 
)
inline

Sets 'buffer_length_' and 'image_buffer_' and calls Initialize(). Do not override this function; override the no-arg overload instead.

MessageHandler* pagespeed::image_compression::MultipleFrameReader::message_handler ( ) const
inline

The message handler used by this class. Neither the caller nor this class have ownership.

virtual ScanlineStatus pagespeed::image_compression::MultipleFrameReader::PrepareNextFrame ( )
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.

virtual ScanlineStatus pagespeed::image_compression::MultipleFrameReader::ReadNextScanline ( const void **  out_scanline_bytes)
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.

bool pagespeed::image_compression::MultipleFrameReader::Reset ( ScanlineStatus status)
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.


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