Page Speed Optimization Libraries
1.13.35.1
|
#include "png_optimizer.h"
Public Member Functions | |
virtual bool | ReadPng (const GoogleString &body, png_structp png_ptr, png_infop info_ptr, int transforms, bool require_opaque) const =0 |
bool | ReadPng (const GoogleString &body, png_structp png_ptr, png_infop info_ptr, int transforms) const |
virtual bool | GetAttributes (const GoogleString &body, int *out_width, int *out_height, int *out_bit_depth, int *out_color_type) const =0 |
Static Public Member Functions | |
static bool | GetBackgroundColor (png_structp png_ptr, png_infop info_ptr, unsigned char *red, unsigned char *green, unsigned char *blue, MessageHandler *handler) |
static bool | IsAlphaChannelOpaque (png_structp png_ptr, png_infop info_ptr, MessageHandler *handler) |
Helper class that provides an API to read a PNG image from some source.
|
pure virtual |
Get just the attributes of the given image. out_bit_depth is the number of bits per channel. out_color_type is one of the PNG_COLOR_TYPE_* declared in png.h.
Implemented in pagespeed::image_compression::PngReader, and pagespeed::image_compression::GifReader.
|
static |
Get the background color, in the form of 8-bit RGB triplets. Note that if the underlying image uses a bit_depth other than 8, the background color will be scaled to 8-bits per channel.
|
static |
Returns true if the alpha channel is actually a opaque. Returns false otherwise. It is an error to call this method for an image that does not have an alpha channel.
|
pure virtual |
Parse the contents of body, convert to a PNG, and populate the PNG structures with the PNG representation. If 'require_opaque' is true, returns an image without an alpha channel if the original image has no transparent pixels, and fails otherwise. Returns true on success, false on failure.
Implemented in pagespeed::image_compression::PngReader, and pagespeed::image_compression::GifReader.
|
inline |
Parse the contents of body, convert to a PNG, and populate the PNG structures with the PNG representation. Returns true on success, false on failure.