Page Speed Optimization Libraries
1.13.35.1
|
#include "image_frame_interface.h"
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. | |
MessageHandler * | message_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) |
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();
|
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.
|
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.
|
inline |
The message handler used by this class. Neither the caller nor this class have ownership.
|
pure virtual |
Prepares to write an image with the characteristics in 'image_spec'.
Implemented in pagespeed::image_compression::ScanlineToFrameWriterAdapter, and pagespeed::image_compression::WebpFrameWriter.
|
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.
|
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.