DLBaseImage Class Reference

An abstract base class for all image types. More...

#include <DLBaseImage.h>

Inheritance diagram for DLBaseImage:

DLBMPImage DLGIFImage DLJPGImage DLPBMImage DLPNGImage DLPPMImage DLTIFFImage List of all members.

Public Member Functions

string getImageName ()
string getExtension ()
bool dlSupportImageExt (string ext)
virtual bool dlSupportImageFile (const char *filename)=0
virtual bool dlSupportImageBuffer (const void *pMemLoc, int size)=0
virtual void dlSaveImage (const char *filename, const DLImage &image)=0
virtual void * dlSaveImageToMem (int &nSize, const DLImage &dlimage)=0
virtual DLImage dlLoadImage (const char *filename)=0
virtual DLImage dlLoadImage (const void *pMemLoc, int nSize)=0
virtual int dlGetTotalPages (void *pMemLoc, int nSize)=0
virtual int dlGetTotalPages (const char *filename)=0
virtual DLImage dlLoadImageAtPage (const char *filename, int pageNumber)=0
virtual DLImage dlLoadImageAtPage (const void *pMemLoc, int nSize, int pageNumber)=0
void dlSetRegistrationPriority (int priority)
int dlGetRegistrationPriority () const
virtual ~DLBaseImage (void)

Static Public Member Functions

static void Tokenize (const string &str, vector< string > &tokens, const string &delimiters=" ")

Protected Member Functions

 DLBaseImage (string imageName, string exts, int regPriorityLevel=5)

Detailed Description

An abstract base class for all image types.

DLBaseImage is used internally by DOCLIB to support the loading and saving of images in a variety of file formats. First see DLImage for the typical DOCLIB programming interface for loading and saving images.

As an abstract base class, no objects of class DLBaseImage are meant to be instantiated.

Any DOCLIB supported image format (i.e. TIFF, JPEG, PPM, etc) needs to be derived from this class and implement its interface to ensure the support of common functionality and enable the plug-in image object design.

DLBaseImage is used by DLImageFactory: see there for details about the design of the image loading and saving system. See also the various derived image format classes for specialized load and save functions specific to that image format.

Definition at line 27 of file DLBaseImage.h.


Constructor & Destructor Documentation

virtual DLBaseImage::~DLBaseImage ( void   )  [virtual]

Destructor

DLBaseImage::DLBaseImage ( string  imageName,
string  exts,
int  regPriorityLevel = 5 
) [protected]

Constructor

Parameters:
imageName A tag to identify the image format object
exts Comma-separated string of file extensions supported by the class (e.g. "jpg,jpeg,jfif")
regPriorityLevel the default registration priority level is hard coded to 5. This value could be overwritten by any int value.


Member Function Documentation

string DLBaseImage::getImageName (  ) 

Returns the name of the image object

Returns:
image name

string DLBaseImage::getExtension (  ) 

Returns the file name extensions supported by the image format object as a comma-separated string (e.g. "tiff,tif")

Returns:
string of image extensions

bool DLBaseImage::dlSupportImageExt ( string  ext  ) 

dlSupportImageExt determines if the image format objeect supports the given image extension.

Returns:
boolean: true if supported

virtual bool DLBaseImage::dlSupportImageFile ( const char *  filename  )  [pure virtual]

This is an abstract function to determine if the given file is supported by the image format object. All derived classes must implement this function because only that particular image object will know its own image format. Derived classes will check for things such as magic numbers or typical header information to make their determination.

Parameters:
filename file to check
Returns:
boolean: true if supported

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

virtual bool DLBaseImage::dlSupportImageBuffer ( const void *  pMemLoc,
int  size 
) [pure virtual]

This is an abstract function to determine if the given buffer is x supported by the image format object. All derived classes must implement this function because only that particular image object will know its own image format. Derived classes will check for things such as magic numbers or typical header information to make their determination.

Parameters:
pMemLoc pointer to start of memory buffer
size size of memory buffer in bytes
Returns:
boolean: true if supported

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

virtual void DLBaseImage::dlSaveImage ( const char *  filename,
const DLImage image 
) [pure virtual]

This is an abstract save function to save a dlImage to a file. This function must be implemented by all child classes to save the image into their own image format.

Parameters:
filename file name to save the image to
image 

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

virtual void* DLBaseImage::dlSaveImageToMem ( int &  nSize,
const DLImage dlimage 
) [pure virtual]

This is an abstract save function to save a dlImage to a memory buffer. This function must be implemented by all child classes to save the image into their own image format.

Parameters:
[out] nSize int size of buffer is returned
[in] dlimage 
Returns:
pointer to memory buffer in which the image was saved

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

virtual DLImage DLBaseImage::dlLoadImage ( const char *  filename  )  [pure virtual]

This is an abstract load function to load a dlImage from a file. This function must be implemented by all child classes to load the image from their own image format into a DLImage.

Parameters:
filename file name to open
Returns:
DLImage

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

virtual DLImage DLBaseImage::dlLoadImage ( const void *  pMemLoc,
int  nSize 
) [pure virtual]

This is an abstract load function to load a dlImage from a memory block. This function must be implemented by all child classes to load the image from their own image format into a DLImage.

Parameters:
pMemLoc pointer to start of memory block to be opened
nSize size of memory block in bytes
Returns:
DLImage

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

static void DLBaseImage::Tokenize ( const string &  str,
vector< string > &  tokens,
const string &  delimiters = " " 
) [static]

Tokenize takes a string and split the string into multiple sub strings separated by a given token.

Parameters:
str string to be tokenize
tokens stores the result of tokens in a vector
delimiters delimiter used to divide the string

virtual int DLBaseImage::dlGetTotalPages ( void *  pMemLoc,
int  nSize 
) [pure virtual]

This is an abstract function to determine the total number of pages in a give image buffer. All child classes must implement this function. If image does not support multiple pages, have function return "1".

Parameters:
pMemLoc pointer to beginning of memory buffer
nSize buffer size in bytes
Returns:
number of pages

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

virtual int DLBaseImage::dlGetTotalPages ( const char *  filename  )  [pure virtual]

This is an abstract function to determine the total number of pages in an image file. All child classes must implement this function. If image does not support multiple pages, have function return "1".

Parameters:
filename file name
Returns:
number of pages

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

virtual DLImage DLBaseImage::dlLoadImageAtPage ( const char *  filename,
int  pageNumber 
) [pure virtual]

dlLoadImageAtPage is an abstract function to load a particular page of an image from a file.

Parameters:
filename Image file name to be opened
pageNumber page number to be opened
Returns:
DLImage of desired page

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

virtual DLImage DLBaseImage::dlLoadImageAtPage ( const void *  pMemLoc,
int  nSize,
int  pageNumber 
) [pure virtual]

dlLoadImageAtPage is an abstract function to load a particular page of an image from a memory buffer.

Parameters:
pMemLoc pointer to beginning of memory image buffer to be opened
nSize size of buffer in bytes
pageNumber page number to be opened
Returns:
DLImage of desired page

Implemented in DLBMPImage, DLGIFImage, DLJPGImage, DLPBMImage, DLPNGImage, DLPPMImage, and DLTIFFImage.

void DLBaseImage::dlSetRegistrationPriority ( int  priority  )  [inline]

dlSetRegistrationPriority sets the registration priority of the image object. This is a common function among all supported types.

Definition at line 174 of file DLBaseImage.h.

int DLBaseImage::dlGetRegistrationPriority (  )  const [inline]

dlGetRegPriority returns the registration priority of the image object. This is a common function among all supported types.

Definition at line 181 of file DLBaseImage.h.


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

DOCLIB is being developed under contract by a collaboration between:
The Laboratory for Language and Media Processing
Unviersity of Maryland, College Park
and
Booz | Allen | Hamilton

All Rights Reserved, 2003-2007