PNG Class Reference

#include <PNG.hpp>

List of all members.


Detailed Description

Used to create PNG Images.

Definition at line 52 of file PNG.hpp.

Public Types

typedef std::auto_ptr< std::string > string_ptr
 Typedef of string pointer using auto_ptr.

Static Public Member Functions

std::string png (const Bitmap &b)
 Get a string representing the contents of a PNG file using a Bitmap.
string_ptr png (const ColorMap &c, int osr=1, int osc=1)
 Get a string representing the contents of a PNG file using an indexed color map.
string_ptr png (const InterpolatedColorMap &c, int osr=1, int osc=1)
 Get a string representing the contents of a PNG file using an indexed color map.
int cost_indexed (const Bitmap &b)
 Get the byte cost of an indexed PNG Returns -1 if the bitmap doesn't have an Indexed/InterpolatedColorMap.
int cost_indexed (int rows, int cols, int numcol)
 Get the byte cost of an indexed PNG with numcol colors.
int cost_constant (const Bitmap &b)
 Get the byte cost of a non-indexed PNG.
int cost_constant (int rows, int cols)
 Get the byte cost of a non-indexed PNG.

Static Protected Member Functions

int cost_idat (int stream)
 Get the cost for IDAT chunks for a stream of this length.
string_ptr ihdr_full (int width, int height)
 IHDR Chunk for full color maps.
string_ptr ihdr_indexed (int width, int height)
 IHDR Chunk for indexed color maps.
string_ptr srgb ()
 sRGB Chunk for telling the PNG renderer to keep the colors pretty
string_ptr phys ()
 pHYs Chunk for telling the PNG renderer pixel width/height
string_ptr plte (const InterpolatedColorMap &c)
 PLTE Chunk for listing the indexed colors.
string_ptr idat (const InterpolatedColorMap &c, int osr, int osc)
 IDAT Chunk for an indexed color map.
string_ptr idat (const ColorMap &c, int osr, int osc)
 IDAT Chunk for a full color map.
string_ptr split (const std::string &str)
 Split up IDAT Chunk to multiple chunks if too large.
string_ptr prefix (const std::string &str)
 Add the IDAT prefix bytes for the zlib stream.
string_ptr huff (const std::string &str)
 Add the segment bits for the huffman format (non compressed).
string_ptr data (const ColorMap &c, int osr, int osc)
 Get the color data for a full color map.
string_ptr data (const InterpolatedColorMap &c, int osr, int osc)
 Get the color data for an indexed color map.
unsigned int alder (const string_ptr &str)
 Get the alder32 checksum for a string.
string_ptr iend ()
 IEND Chunk required at end of PNG.
string_ptr chunk (const std::string &title, const std::string &text)
 Add chunk bits (length, checksum) before and after chunk bytes.
string_ptr itos (int i)
 Integer to string of 4 bytes.
string_ptr ctos (const Color &color)
 Color to string of 3 bytes.
char btoc (int b)
 Byte to single character.

Static Protected Attributes

const std::string header
 PNG file format header bytes.


Member Typedef Documentation

typedef std::auto_ptr<std::string> string_ptr
 

Typedef of string pointer using auto_ptr.

Definition at line 56 of file PNG.hpp.

Referenced by chunk(), ctos(), data(), huff(), idat(), iend(), ihdr_full(), ihdr_indexed(), itos(), phys(), plte(), prefix(), split(), and srgb().


Member Function Documentation

unsigned int alder const string_ptr str  )  [static, protected]
 

Get the alder32 checksum for a string.

Definition at line 346 of file PNG.cpp.

References Adler32::getValue(), and Adler32::update().

Referenced by idat().

char btoc int  b  )  [static, protected]
 

Byte to single character.

Definition at line 392 of file PNG.cpp.

Referenced by ctos(), data(), huff(), ihdr_full(), ihdr_indexed(), itos(), phys(), prefix(), and srgb().

PNG::string_ptr chunk const std::string &  title,
const std::string &  text
[static, protected]
 

Add chunk bits (length, checksum) before and after chunk bytes.

Definition at line 358 of file PNG.cpp.

References CRC32::getValue(), itos(), string_ptr, and CRC32::update().

Referenced by iend(), ihdr_full(), ihdr_indexed(), phys(), plte(), split(), and srgb().

int cost_constant int  rows,
int  cols
[static]
 

Get the byte cost of a non-indexed PNG.

Definition at line 122 of file PNG.cpp.

References cost_idat().

int cost_constant const Bitmap b  )  [static]
 

Get the byte cost of a non-indexed PNG.

Definition at line 107 of file PNG.cpp.

References Bitmap::getCM(), ColorMap::getCols(), InterpolatedColorMap::getCols(), Bitmap::getICM(), ColorMap::getRows(), InterpolatedColorMap::getRows(), Bitmap::osc, and Bitmap::osr.

int cost_idat int  stream  )  [static, protected]
 

Get the cost for IDAT chunks for a stream of this length.

Definition at line 132 of file PNG.cpp.

Referenced by cost_constant(), and cost_indexed().

int cost_indexed int  rows,
int  cols,
int  numcol
[static]
 

Get the byte cost of an indexed PNG with numcol colors.

Definition at line 96 of file PNG.cpp.

References cost_idat().

int cost_indexed const Bitmap b  )  [static]
 

Get the byte cost of an indexed PNG Returns -1 if the bitmap doesn't have an Indexed/InterpolatedColorMap.

Definition at line 86 of file PNG.cpp.

References InterpolatedColorMap::getCols(), Bitmap::getICM(), InterpolatedColorMap::getRows(), Bitmap::osc, and Bitmap::osr.

PNG::string_ptr ctos const Color color  )  [static, protected]
 

Color to string of 3 bytes.

Definition at line 381 of file PNG.cpp.

References btoc(), Color::getRGB(), and string_ptr.

Referenced by data(), and plte().

PNG::string_ptr data const InterpolatedColorMap c,
int  osr,
int  osc
[static, protected]
 

Get the color data for an indexed color map.

Definition at line 323 of file PNG.cpp.

References btoc(), InterpolatedColorMap::getCols(), InterpolatedColorMap::getIndex(), InterpolatedColorMap::getRows(), and string_ptr.

PNG::string_ptr data const ColorMap c,
int  osr,
int  osc
[static, protected]
 

Get the color data for a full color map.

Definition at line 301 of file PNG.cpp.

References btoc(), ctos(), ColorMap::get(), ColorMap::getCols(), ColorMap::getRows(), and string_ptr.

Referenced by idat().

PNG::string_ptr huff const std::string &  str  )  [static, protected]
 

Add the segment bits for the huffman format (non compressed).

Definition at line 272 of file PNG.cpp.

References btoc(), and string_ptr.

Referenced by idat().

PNG::string_ptr idat const ColorMap c,
int  osr,
int  osc
[static, protected]
 

IDAT Chunk for a full color map.

Definition at line 220 of file PNG.cpp.

References alder(), data(), huff(), itos(), prefix(), split(), and string_ptr.

PNG::string_ptr idat const InterpolatedColorMap c,
int  osr,
int  osc
[static, protected]
 

IDAT Chunk for an indexed color map.

Definition at line 209 of file PNG.cpp.

References alder(), data(), huff(), itos(), prefix(), split(), and string_ptr.

PNG::string_ptr iend  )  [static, protected]
 

IEND Chunk required at end of PNG.

Definition at line 353 of file PNG.cpp.

References chunk(), and string_ptr.

PNG::string_ptr ihdr_full int  width,
int  height
[static, protected]
 

IHDR Chunk for full color maps.

Definition at line 143 of file PNG.cpp.

References btoc(), chunk(), itos(), and string_ptr.

PNG::string_ptr ihdr_indexed int  width,
int  height
[static, protected]
 

IHDR Chunk for indexed color maps.

Definition at line 156 of file PNG.cpp.

References btoc(), chunk(), itos(), and string_ptr.

PNG::string_ptr itos int  i  )  [static, protected]
 

Integer to string of 4 bytes.

Definition at line 371 of file PNG.cpp.

References btoc(), and string_ptr.

Referenced by chunk(), idat(), ihdr_full(), ihdr_indexed(), and phys().

PNG::string_ptr phys  )  [static, protected]
 

pHYs Chunk for telling the PNG renderer pixel width/height

Definition at line 177 of file PNG.cpp.

References btoc(), chunk(), itos(), and string_ptr.

PNG::string_ptr plte const InterpolatedColorMap c  )  [static, protected]
 

PLTE Chunk for listing the indexed colors.

Definition at line 186 of file PNG.cpp.

References chunk(), ctos(), Palette::getColor(), InterpolatedColorMap::getPalette(), and string_ptr.

string_ptr png const InterpolatedColorMap c,
int  osr = 1,
int  osc = 1
[static]
 

Get a string representing the contents of a PNG file using an indexed color map.

string_ptr png const ColorMap c,
int  osr = 1,
int  osc = 1
[static]
 

Get a string representing the contents of a PNG file using an indexed color map.

std::string png const Bitmap b  )  [static]
 

Get a string representing the contents of a PNG file using a Bitmap.

This is a helper function to call the others.

PNG::string_ptr prefix const std::string &  str  )  [static, protected]
 

Add the IDAT prefix bytes for the zlib stream.

Definition at line 253 of file PNG.cpp.

References btoc(), log, and string_ptr.

Referenced by idat().

PNG::string_ptr split const std::string &  str  )  [static, protected]
 

Split up IDAT Chunk to multiple chunks if too large.

Definition at line 231 of file PNG.cpp.

References chunk(), and string_ptr.

Referenced by idat().

PNG::string_ptr srgb  )  [static, protected]
 

sRGB Chunk for telling the PNG renderer to keep the colors pretty

Definition at line 170 of file PNG.cpp.

References btoc(), chunk(), and string_ptr.


Member Data Documentation

const std::string header [static, protected]
 

PNG file format header bytes.

Definition at line 91 of file PNG.hpp.


The documentation for this class was generated from the following files:
Generated on Mon Feb 6 03:31:24 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1