#include <DLBaseImage.h>
Inheritance diagram for DLBaseImage:
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) |
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.
virtual DLBaseImage::~DLBaseImage | ( | void | ) | [virtual] |
Destructor
DLBaseImage::DLBaseImage | ( | string | imageName, | |
string | exts, | |||
int | regPriorityLevel = 5 | |||
) | [protected] |
Constructor
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. |
string DLBaseImage::getImageName | ( | ) |
Returns the name of the image object
string DLBaseImage::getExtension | ( | ) |
Returns the file name extensions supported by the image format object as a comma-separated string (e.g. "tiff,tif"
)
bool DLBaseImage::dlSupportImageExt | ( | string | ext | ) |
dlSupportImageExt determines if the image format objeect supports the given image extension.
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.
filename | file to check |
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.
pMemLoc | pointer to start of memory buffer | |
size | size of memory buffer in bytes |
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.
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.
[out] | nSize | int size of buffer is returned |
[in] | dlimage |
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.
filename | file name to open |
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.
pMemLoc | pointer to start of memory block to be opened | |
nSize | size of memory block in bytes |
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.
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".
pMemLoc | pointer to beginning of memory buffer | |
nSize | buffer size in bytes |
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".
filename | file name |
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.
filename | Image file name to be opened | |
pageNumber | page number to be opened |
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.
pMemLoc | pointer to beginning of memory image buffer to be opened | |
nSize | size of buffer in bytes | |
pageNumber | page number to be opened |
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.