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

#include "image_frame_interface.h"

Inheritance diagram for pagespeed::image_compression::MultipleFrameWriter:
pagespeed::image_compression::ScanlineToFrameWriterAdapter pagespeed::image_compression::WebpFrameWriter

Public Member Functions

 MultipleFrameWriter (MessageHandler *handler)
 
virtual ScanlineStatus Initialize (const void *config, GoogleString *out)=0
 
virtual ScanlineStatus PrepareImage (const ImageSpec *image_spec)=0
 
virtual ScanlineStatus PrepareNextFrame (const FrameSpec *frame_spec)=0
 
virtual ScanlineStatus WriteNextScanline (const void *scanline_bytes)=0
 
virtual ScanlineStatus FinalizeWrite ()=0
 Finalizes the image once all the frames have been written.
 
MessageHandlermessage_handler () const
 
bool Initialize (const void *config, GoogleString *out, ScanlineStatus *status)
 
bool PrepareImage (const ImageSpec *image_spec, ScanlineStatus *status)
 
bool PrepareNextFrame (const FrameSpec *frame_spec, ScanlineStatus *status)
 
bool WriteNextScanline (const void *scanline_bytes, ScanlineStatus *status)
 
bool FinalizeWrite (ScanlineStatus *status)
 

Detailed Description

Interface for writing both animated and static images.

Typical usage of this API is as follows: Initialize(); PrepareImage(); while (have_frame) { PrepareNextFrame(); while (have_scanline) { WriteNextScanline(); } } FinalizeWrite();

Member Function Documentation

virtual ScanlineStatus pagespeed::image_compression::MultipleFrameWriter::Initialize ( const void *  config,
GoogleString out 
)
pure virtual

Initializes the writer to use the format-specific configuration in 'config' to write an image to 'out'. It is up to the client to ensure 'config' points to data of the right type for the given child class it invokes.

Implemented in pagespeed::image_compression::ScanlineToFrameWriterAdapter, and pagespeed::image_compression::WebpFrameWriter.

bool pagespeed::image_compression::MultipleFrameWriter::Initialize ( const void *  config,
GoogleString out,
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.

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

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

virtual ScanlineStatus pagespeed::image_compression::MultipleFrameWriter::PrepareImage ( const ImageSpec image_spec)
pure virtual

Prepares to write an image with the characteristics in 'image_spec'.

Implemented in pagespeed::image_compression::ScanlineToFrameWriterAdapter, and pagespeed::image_compression::WebpFrameWriter.

virtual ScanlineStatus pagespeed::image_compression::MultipleFrameWriter::PrepareNextFrame ( const FrameSpec frame_spec)
pure virtual

Prepares to write scanlines to the frame after the current one by setting its properties to 'frame_spec'. Must be called before writing to the first frame.

Implemented in pagespeed::image_compression::ScanlineToFrameWriterAdapter, and pagespeed::image_compression::WebpFrameWriter.

virtual ScanlineStatus pagespeed::image_compression::MultipleFrameWriter::WriteNextScanline ( const void *  scanline_bytes)
pure virtual

Writes 'scanline_bytes' to the next scanline of the current frame. The scanline's width in pixels and pixel format (and thus, its width in bytes) are as set in the preceding call to PrepareNextFrame(); that many bytes from '*scanline_bytes' are read.

Implemented in pagespeed::image_compression::ScanlineToFrameWriterAdapter, and pagespeed::image_compression::WebpFrameWriter.


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