Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
imagen::iPNG Class Reference

Reads / writes Portable Network Graphic (PNG) files. More...

#include <iPNG.h>

Inheritance diagram for imagen::iPNG:
imagen::iAbstractImage

List of all members.

Public Types

enum  PNGInterlaceType { InterlaceNone, InterlaceAdam7 }
 PNG interlace type. More...

Public Member Functions

 iPNG ()
 Constructs a null image.
 iPNG (const iPNG &img)
 Copy constructor.
 iPNG (const iAbstractImage &img)
 iAbstractImage copy constructor.
 iPNG (int w, int h, iImageFormat f)
 Constructs an image with the given size and format.
 iPNG (Iubyte *d, int w, int h, iImageFormat f, int b)
 Constructs an image using an existing memory buffer.
 iPNG (const char *filename)
 Loads a PNG image file from disk.
 iPNG (Iubyte *buf, int len)
 Loads a PNG image from an existing memory buffer.
 iPNG (iDataStream *s)
 Loads a PNG image using an existing data stream.
 ~iPNG ()
 Destructor.
void clear ()
 Detaches this image from the image data and resets all data members to their initial values.
bool isFormatSupported (iImageFormat fmt) const
 Checks whether or not a given image color format is supported by this image type.
void setCompressLevel (int lvl)
 Sets the level of compression when writing PNG images.
int getCompressLevel () const
 Gets the level of compression when writing PNG images.
void setInterlaceType (PNGInterlaceType type)
 Sets the type of interlacing to use when writing PNG images.
PNGInterlaceType getInterlaceType () const
 Gets the type of interlacing to use when writing PNG images.
iPNGoperator= (const iPNG &img)
iPNGoperator= (const iAbstractImage &img)

Static Public Member Functions

static bool isValid (iDataStream *s)

Protected Member Functions

void init ()
bool loadImage ()
bool saveImage ()

Detailed Description

Reads / writes Portable Network Graphic (PNG) files.

Extensions:
.png

Image types:
Grayscale, indexed, and truecolor

Pixel Depths:
8-bit, 16-bit, 24-bit, and 32-bit

TODO:
Gamma correction.
ICC profiles.
Write custom chunks.


Member Enumeration Documentation

PNG interlace type.

Enumerator:
InterlaceNone 
InterlaceAdam7 

Constructor & Destructor Documentation

Constructs a null image.

imagen::iPNG::iPNG ( const iPNG img)

Copy constructor.

This copies all image attributes, and attaches itself to img's shared data.

iAbstractImage copy constructor.

imagen::iPNG::iPNG ( int  w,
int  h,
iImageFormat  f 
)

Constructs an image with the given size and format.

The image data will be allocated, but not initialized.

Parameters:
w: Image width.
h: Image height.
f: Image format.
imagen::iPNG::iPNG ( Iubyte d,
int  w,
int  h,
iImageFormat  f,
int  b 
)

Constructs an image using an existing memory buffer.

The memory buffer will not be deleted at destruction.

See also:
loadData()
imagen::iPNG::iPNG ( const char *  filename)

Loads a PNG image file from disk.

See also:
load( const char *filename )
imagen::iPNG::iPNG ( Iubyte buf,
int  len 
)

Loads a PNG image from an existing memory buffer.

See also:
load( Iubyte *buf, int len )

Loads a PNG image using an existing data stream.

See also:
load( iDataStream *s )

Destructor.


Member Function Documentation

void imagen::iPNG::clear ( ) [virtual]

Detaches this image from the image data and resets all data members to their initial values.

Reimplemented from imagen::iAbstractImage.

bool imagen::iPNG::isFormatSupported ( iImageFormat  fmt) const [virtual]

Checks whether or not a given image color format is supported by this image type.

Returns:
True if the format is supported, else false.

Implements imagen::iAbstractImage.

static bool imagen::iPNG::isValid ( iDataStream s) [static]
void imagen::iPNG::setCompressLevel ( int  lvl)

Sets the level of compression when writing PNG images.

The compression level must be between 0 and 9.
0 = No compression.
9 = Max compression.
The compression level is set to 9 by default.

int imagen::iPNG::getCompressLevel ( ) const [inline]

Gets the level of compression when writing PNG images.

Sets the type of interlacing to use when writing PNG images.

Gets the type of interlacing to use when writing PNG images.

iPNG& imagen::iPNG::operator= ( const iPNG img)
iPNG& imagen::iPNG::operator= ( const iAbstractImage img)

Reimplemented from imagen::iAbstractImage.

void imagen::iPNG::init ( ) [protected]

Reimplemented from imagen::iAbstractImage.

bool imagen::iPNG::loadImage ( ) [protected, virtual]
bool imagen::iPNG::saveImage ( ) [protected, virtual]

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