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

#include "png_optimizer.h"

Inheritance diagram for pagespeed::image_compression::PngScanlineReaderRaw:

Public Member Functions

 PngScanlineReaderRaw (MessageHandler *handler)
virtual bool Reset ()
virtual ScanlineStatus InitializeWithStatus (const void *image_buffer, size_t buffer_length)
virtual ScanlineStatus ReadNextScanlineWithStatus (void **out_scanline_bytes)
virtual size_t GetBytesPerScanline ()
 Return the number of bytes in a row (without padding).
virtual bool HasMoreScanLines ()
 Returns true if there are more scanlines to read.
virtual PixelFormat GetPixelFormat ()
 Returns the pixel format that need to be used by writer.
virtual size_t GetImageHeight ()
 Returns the height of the image.
virtual size_t GetImageWidth ()
 Returns the width of the image.
virtual bool IsProgressive ()
- Public Member Functions inherited from pagespeed::image_compression::ScanlineReaderInterface
bool Initialize (const void *image_buffer, size_t buffer_length)
bool ReadNextScanline (void **out_scanline_bytes)

Detailed Description

Class PngScanlineReaderRaw decodes PNG images and outputs the raw pixel data, image size, pixel type, etc. The class accepts all formats supported by libpng. The output is Gray_8, RGB_888, or RGBA_8888. The following transformations are used:

Note: The input image stream must be valid throughout the life of the object. In other words, the image_buffer input you set to the Initialize() method cannot be changed until your last call to the ReadNextScanline() method.

Member Function Documentation

virtual ScanlineStatus pagespeed::image_compression::PngScanlineReaderRaw::InitializeWithStatus ( const void *  image_buffer,
size_t  buffer_length 

Initialize the reader with the given image stream. Note that image_buffer must remain unchanged until the last call to ReadNextScanline().

Implements pagespeed::image_compression::ScanlineReaderInterface.

virtual bool pagespeed::image_compression::PngScanlineReaderRaw::IsProgressive ( )

Returns true if the original image was encoded progressively by the origin site, so that it could be progressively rendered while the image contents were being transferred

Implements pagespeed::image_compression::ScanlineReaderInterface.

virtual ScanlineStatus pagespeed::image_compression::PngScanlineReaderRaw::ReadNextScanlineWithStatus ( void **  out_scanline_bytes)

Return the next row of pixels. For non-progressive PNG, ReadNextScanlineWithStatus will decode one row of pixels each time when it is called, but for progressive PNG, ReadNextScanlineWithStatus will decode the entire image at the first time when it is called.

Implements pagespeed::image_compression::ScanlineReaderInterface.

virtual bool pagespeed::image_compression::PngScanlineReaderRaw::Reset ( )

This will only return false as a result of a longjmp due to an unhandled libpng error.

Implements pagespeed::image_compression::ScanlineReaderInterface.

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