Page Speed Optimization Libraries
1.13.35.1
|
#include "jpeg_optimizer.h"
Public Member Functions | |
JpegScanlineWriter (MessageHandler *handler) | |
void | SetJmpBufEnv (jmp_buf *env) |
Set the environment for longjmp calls. | |
void | AbortWrite () |
virtual ScanlineStatus | InitWithStatus (const size_t width, const size_t height, PixelFormat pixel_format) |
Initialize the basic parameter for writing the image. | |
virtual ScanlineStatus | InitializeWriteWithStatus (const void *params, GoogleString *compressed) |
virtual ScanlineStatus | WriteNextScanlineWithStatus (const void *scanline_bytes) |
virtual ScanlineStatus | FinalizeWriteWithStatus () |
Finalizes write structure once all scanlines are written. | |
Public Member Functions inherited from pagespeed::image_compression::ScanlineWriterInterface | |
bool | Init (const size_t width, const size_t height, PixelFormat pixel_format) |
bool | InitializeWrite (const void *config, GoogleString *const out) |
bool | WriteNextScanline (const void *scanline_bytes) |
bool | FinalizeWrite () |
User of this class must call this functions in the following sequence func () { JpegScanlineWriter jpeg_writer; jmp_buf env; if (setjmp(env)) { jpeg_writer.AbortWrite(); return; } jpeg_writer.SetJmpBufEnv(&env); if (jpeg_writer.Init(width, height, format)) { jpeg_writer.SetJpegCompressParams(quality); jpeg_writer.InitializeWrite(out); while(has_lines_to_write) { writer.WriteNextScanline(next_scan_line); } writer.FinalizeWrite() } }
void pagespeed::image_compression::JpegScanlineWriter::AbortWrite | ( | ) |
This function is only called when jpeg library call longjmp for cleaning up the jpeg structs.
|
virtual |
Set the compression options via 'params', which should be a JpegCompressionOptions*. Since writer only supports lossy encoding, it is an error to pass in a 'params' that has the lossy field set to false.
Implements pagespeed::image_compression::ScanlineWriterInterface.
|
virtual |
Writes the current scan line with data provided. Returns false if the write fails.
Implements pagespeed::image_compression::ScanlineWriterInterface.