Page Speed Optimization Libraries
1.13.35.1
|
#include "image_resizer.h"
Public Member Functions | |
ScanlineResizer (MessageHandler *handler) | |
bool | Initialize (ScanlineReaderInterface *reader, size_t output_width, size_t output_height) |
Initializes the resizer with a reader and the desired output size. | |
virtual ScanlineStatus | ReadNextScanlineWithStatus (void **out_scanline_bytes) |
virtual bool | Reset () |
Resets the resizer to its initial state. Always returns true. | |
virtual size_t | GetBytesPerScanline () |
Returns number of bytes required to store a scanline. | |
virtual bool | HasMoreScanLines () |
virtual size_t | GetImageHeight () |
Returns the height of the image. | |
virtual size_t | GetImageWidth () |
Returns the width of the image. | |
virtual PixelFormat | GetPixelFormat () |
Returns the pixel format of the image. | |
virtual bool | IsProgressive () |
Returns true if the image is encoded in progressive / interlacing format. | |
virtual ScanlineStatus | InitializeWithStatus (const void *image_buffer, size_t buffer_length) |
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) |
Static Public Attributes | |
static const size_t | kPreserveAspectRatio = 0 |
Class ScanlineResizer resizes an image, and outputs a scanline at a time. To use it, you need to provide an initialized reader implementing ScanlineReaderInterface. The ScanlineResizer object will instruct the reader to fetch the image scanlines required for the resized scanline.
You can specify the width, the height, or both in pixels. If you want to preserve the aspect ratio, you can specify only one of them, and pass in kPreserveAspectRatio for the other one.
Currently, ScanlineResizer only supports shrinking. It works best when the image shrinks significantly, e.g, by more than 2x times.
|
virtual |
Returns true if there are more scanlines to read. Returns false if the object has not been initialized or all of the scanlines have been read.
Implements pagespeed::image_compression::ScanlineReaderInterface.
|
virtual |
This method should not be called. If it does get called, in DEBUG mode it will throw a FATAL error and in RELEASE mode it does nothing.
Implements pagespeed::image_compression::ScanlineReaderInterface.
|
virtual |
Reads the next available scanline. Returns an error if the next scanline is not available. This can happen when the reader cannot provide enough image rows, or when all of the scanlines have been read.
Implements pagespeed::image_compression::ScanlineReaderInterface.