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

Public Member Functions

 GifSquare (bool manual_gcb, net_instaweb::MessageHandler *handler)
 
bool Open (const GoogleString &filename)
 
bool PrepareScreen (bool gif89, size_px width, size_px height, const GifColorType *color_map, int num_colors, int bg_color_idx, size_t loop_count)
 
bool PutImage (size_px left, size_px top, size_px width, size_px height, const GifColorType *colormap, int num_colors, int color_index, int transparent_idx, bool interlace, int delay_cs, int disposal_method)
 
bool AnimateAllImages (int delay_cs, int transparent_idx, int disposal_method)
 
bool Close ()
 Flushes and closes the GIF file.
 

Static Public Attributes

static const size_t kNoLoopCountSpecified
 
static const GifColorType kGifWhite
 
static const GifColorType kGifBlack
 
static const GifColorType kGifGray
 
static const GifColorType kGifRed
 
static const GifColorType kGifGreen
 
static const GifColorType kGifBlue
 
static const GifColorType kGifYellow
 

Member Function Documentation

bool pagespeed::image_compression::GifSquare::AnimateAllImages ( int  delay_cs,
int  transparent_idx,
int  disposal_method 
)

Animates all GIF images by specifying that they should each be displayed for 'delay_cs' centiseconds, be disposed according to 'disposal_method', and have the 'transparent_idx' color of the previously-specified colormap be transparent

bool pagespeed::image_compression::GifSquare::Open ( const GoogleString filename)

Opens a GIF file under the given 'filename'. Returns true on success.

bool pagespeed::image_compression::GifSquare::PrepareScreen ( bool  gif89,
size_px  width,
size_px  height,
const GifColorType *  color_map,
int  num_colors,
int  bg_color_idx,
size_t  loop_count 
)

Prepares the GIF screen to have dimensions 'width' by 'height', a background color 'bg_color_idx' into the 'colormap' of size 'num_colors' (a power of 2) that is used for the image. It marks this as a GIF89 image if 'gif89' is set. If loop_count is less than kNoLoopCountSpecified, it inserts an application extension block indicating to loop the animation forever (if zero) or the specified number of times. Returns true on success.

NOTE: Chrome (at least v35) interprets the loop_count as the number of times to repeat the animation, so the user will see the animation loop_count+1 times.

bool pagespeed::image_compression::GifSquare::PutImage ( size_px  left,
size_px  top,
size_px  width,
size_px  height,
const GifColorType *  colormap,
int  num_colors,
int  color_index,
int  transparent_idx,
bool  interlace,
int  delay_cs,
int  disposal_method 
)

Puts a single GIF image. The image is a 'width' by 'height' rectangle whose color is given by the 'color_index'-th entry of the 'colormap', is positioned at position 'left', 'top' from the top left of the GIF screen, and will be discarded as per 'disposal_method'. The 'transparent_idx'-th color is marked as being fully transparent. The image is marked as being interlaced if 'interlace' is set, and is displayed for a duration of 'delay_cs' centiseconds.

Returns true on success.


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