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

Reads / writes Joint Photographic Experts Group (JPEG) files. More...

#include <iJPEG.h>

Inheritance diagram for imagen::iJPEG:
imagen::iAbstractImage

List of all members.

Public Types

enum  JpegDCTMethod { DCTInteger, DCTFastInteger, DCTFloat }
 JPEG DCT Method. More...
enum  JpegSubsampling { SubSample444, SubSample422, SubSample411 }
 JPEG Subsampling. More...

Public Member Functions

 iJPEG ()
 Constructs a null image.
 iJPEG (const iJPEG &img)
 Copy constructor.
 iJPEG (const iAbstractImage &img)
 iAbstractImage copy constructor.
 iJPEG (int w, int h, iImageFormat f)
 Constructs an image with the given size and format.
 iJPEG (Iubyte *d, int w, int h, iImageFormat f, int b)
 Constructs an image using an existing memory buffer.
 iJPEG (const char *filename)
 Loads a JPEG image file from disk.
 iJPEG (Iubyte *buf, int len)
 Loads a JPEG image from an existing memory buffer.
 iJPEG (iDataStream *s)
 Loads a JPEG image using an existing data stream.
 ~iJPEG ()
 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 setQuality (int q)
 Sets the quality to use when writing JPEG images.
int getQuality () const
 Gets the quality used when writing JPEG images.
void setSmoothing (int sm)
 Sets the amount of smoothing to use when writing JPEG images.
int getSmoothing () const
 Gets the amount of smoothing used when writing JPEG images.
void setDCTMethod (JpegDCTMethod dct)
 Sets the algorithm to use for the DCT step when writing JPEG images.
JpegDCTMethod getDCTMethod () const
 Gets the algorithm used for the DCT step when writing JPEG images.
void setSubsampling (JpegSubsampling ss)
 Sets the subsampling to use when writing JPEG images.
JpegSubsampling getSubsampling () const
 Gets the subsampling used when writing JPEG images.
void enableProgression (bool bprg)
 Enables progression when writing a JPEG image.
void enableOptimization (bool bopt)
 Enables optimization when writing a JPEG image.
void enableChromaDownsampling (bool bdown)
 Enables chroma downsampling when writing a JPEG image.
void saveExif (bool bexif)
 Saves Exif metadata when writing a JPEG image.
void saveThumbnail (bool bthumb)
 Saves an embedded thumbnail image when writing a JPEG image.
iJPEGoperator= (const iJPEG &img)
iJPEGoperator= (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 Joint Photographic Experts Group (JPEG) files.

Extensions:
jpg, jpeg, jpe, jif, jfif, and jfi

Image types:
Grayscale and truecolor

Pixel Depths:
8-bit and 24-bit

TODO:
Exif metadata
Thumbnail
Comments
Restart markers


Member Enumeration Documentation

JPEG DCT Method.

Enumerator:
DCTInteger 
DCTFastInteger 
DCTFloat 

JPEG Subsampling.

Enumerator:
SubSample444 

Best quality.

SubSample422 

Intermediate.

SubSample411 

Smallest size.


Constructor & Destructor Documentation

Constructs a null image.

imagen::iJPEG::iJPEG ( const iJPEG img)

Copy constructor.

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

iAbstractImage copy constructor.

imagen::iJPEG::iJPEG ( 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::iJPEG::iJPEG ( 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::iJPEG::iJPEG ( const char *  filename)

Loads a JPEG image file from disk.

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

Loads a JPEG image from an existing memory buffer.

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

Loads a JPEG image using an existing data stream.

See also:
load( iDataStream *s )

Destructor.


Member Function Documentation

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

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

Reimplemented from imagen::iAbstractImage.

bool imagen::iJPEG::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::iJPEG::isValid ( iDataStream s) [static]
void imagen::iJPEG::setQuality ( int  q)

Sets the quality to use when writing JPEG images.

Must be in the range of 0 to 100.
It is set to a reasonable default: 85.

int imagen::iJPEG::getQuality ( ) const [inline]

Gets the quality used when writing JPEG images.

void imagen::iJPEG::setSmoothing ( int  sm)

Sets the amount of smoothing to use when writing JPEG images.

Must be in the range of 0 to 100.
It is set to 0 (no smoothing) by default.

int imagen::iJPEG::getSmoothing ( ) const [inline]

Gets the amount of smoothing used when writing JPEG images.

Sets the algorithm to use for the DCT step when writing JPEG images.

It is set to iJPEG::DCTInteger by default.

Gets the algorithm used for the DCT step when writing JPEG images.

Sets the subsampling to use when writing JPEG images.

It is set to iJPEG::SubSample411 by default.

Gets the subsampling used when writing JPEG images.

void imagen::iJPEG::enableProgression ( bool  bprg) [inline]

Enables progression when writing a JPEG image.

Progression is disabled by default.

void imagen::iJPEG::enableOptimization ( bool  bopt) [inline]

Enables optimization when writing a JPEG image.

Optimization uses more time and memory, but yields slightly smaller image sizes.
Optimization is enabled by default.

void imagen::iJPEG::enableChromaDownsampling ( bool  bdown) [inline]

Enables chroma downsampling when writing a JPEG image.

Disabling chroma downsampling can slightly improve image quality, but enlarge the image size.
Chroma downsampling is enabled by default.

void imagen::iJPEG::saveExif ( bool  bexif) [inline]

Saves Exif metadata when writing a JPEG image.

void imagen::iJPEG::saveThumbnail ( bool  bthumb) [inline]

Saves an embedded thumbnail image when writing a JPEG image.

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

Reimplemented from imagen::iAbstractImage.

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

Reimplemented from imagen::iAbstractImage.

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

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