Canola  0.8.D001
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions
image_format_png Class Reference

#include <png.h>

Inheritance diagram for image_format_png:
image_format image

List of all members.

Public Member Functions

virtual ~image_format_png ()

Static Public Member Functions

static pointer create (const std::string &filename)
static pointer create_blank (int width, int height)

Protected Member Functions

const char * type_name () const
void save_to_file (const std::string &filename) const

Private Member Functions

bool calc_needs_alpha () const
bool calc_needs_rgb () const
 image_format_png ()
 image_format_png (int width, int height, data_t *data)
 image_format_png (int width, int height)
 image_format_png (const image_format_png &)
image_format_pngoperator= (const image_format_png &)

Detailed Description

The image_format_png class is used to represent an image in PNG format.

Definition at line 27 of file png.h.


Constructor & Destructor Documentation

The destructor.

Definition at line 29 of file png.cc.

The default constructor. Do not use.

image_format_png::image_format_png ( int  width,
int  height,
data_t data 
) [private]

The constructor.

Parameters:
widthThe width of the new image
heightThe height of the new image
dataThe data of the new image, indexed row then column then component (RGBA).

Definition at line 40 of file png.cc.

image_format_png::image_format_png ( int  width,
int  height 
) [private]

The constructor.

Parameters:
widthThe width of the new image
heightThe height of the new image

Definition at line 34 of file png.cc.

The copy constructor. Do not use.


Member Function Documentation

bool image_format_png::calc_needs_alpha ( void  ) const [private]

The calc_needs_alpha method is used by the save_to_file method to determine whether or not the alpha channel needs to be stored into the output file (i.e. if any pixel has an alpha != 255).

Returns:
true of the image needs an explict alpha channel, false if an explict (all alpha == 255) channel is sufficient.

Definition at line 216 of file png.cc.

bool image_format_png::calc_needs_rgb ( void  ) const [private]

The calc_needs_rgb method is used by the save_to_file method to determine whether or not the data is grayscale (r == b == b for all pixels). Completely transparent pixels are ignored.

Returns:
true if at least one pixel (r != g || r != b), false if all the pixels can be represented with a grayscale file.

Definition at line 233 of file png.cc.

image::pointer image_format_png::create ( const std::string &  filename) [static]

The create class method is used to create an image by reading a file.

Parameters:
filenameThe name of the file to be read.

Definition at line 65 of file png.cc.

image::pointer image_format_png::create_blank ( int  width,
int  height 
) [static]

The create_blank class method is used to create a new image which is entirely blank (and transparent).

Parameters:
widthThe width of the image
heightThe height of the image

Definition at line 390 of file png.cc.

image_format_png& image_format_png::operator= ( const image_format_png ) [private]

The assignment operator. Do not use.

void image_format_png::save_to_file ( const std::string &  filename) const [protected, virtual]

The save_to_file method is used to store the image data into a file on disk.

Parameters:
filenameThe name of the file to be written.

Reimplemented from image_format.

Definition at line 250 of file png.cc.

const char * image_format_png::type_name ( ) const [protected, virtual]

The type_name method is used to obtain the name of the type of this image format.

Implements image.

Definition at line 47 of file png.cc.


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