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

Reader for PNG-encoded data. More...

#include "png_optimizer.h"

Inheritance diagram for pagespeed::image_compression::PngReader:
pagespeed::image_compression::PngReaderInterface

Public Member Functions

 PngReader (MessageHandler *handler)
 
virtual bool ReadPng (const GoogleString &body, png_structp png_ptr, png_infop info_ptr, int transforms, bool require_opaque) const
 
virtual bool GetAttributes (const GoogleString &body, int *out_width, int *out_height, int *out_bit_depth, int *out_color_type) const
 
- Public Member Functions inherited from pagespeed::image_compression::PngReaderInterface
bool ReadPng (const GoogleString &body, png_structp png_ptr, png_infop info_ptr, int transforms) const
 

Additional Inherited Members

- Static Public Member Functions inherited from pagespeed::image_compression::PngReaderInterface
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)
 

Detailed Description

Reader for PNG-encoded data.

Member Function Documentation

virtual bool pagespeed::image_compression::PngReader::GetAttributes ( const GoogleString body,
int *  out_width,
int *  out_height,
int *  out_bit_depth,
int *  out_color_type 
) const
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.

Todo:
TODO(bmcquade): consider merging this with ImageAttributes.

Implements pagespeed::image_compression::PngReaderInterface.

virtual bool pagespeed::image_compression::PngReader::ReadPng ( const GoogleString body,
png_structp  png_ptr,
png_infop  info_ptr,
int  transforms,
bool  require_opaque 
) const
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.

Implements pagespeed::image_compression::PngReaderInterface.


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