You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
171 lines
4.6 KiB
171 lines
4.6 KiB
15 years ago
|
/*
|
||
|
* kimageio.h -- Declaration of interface to the KDE Image IO library.
|
||
|
* Sirtaj Singh Kang <taj@kde.org>, 23 Sep 1998.
|
||
|
*
|
||
|
* This library is distributed under the conditions of the GNU LGPL.
|
||
|
*/
|
||
|
|
||
|
#ifndef SSK_KIMGIO_H
|
||
|
#define SSK_KIMGIO_H
|
||
|
|
||
14 years ago
|
#include <tqstringlist.h>
|
||
15 years ago
|
|
||
13 years ago
|
#include <tdelibs_export.h>
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Interface to the KDE Image IO plugin architecture.
|
||
|
*
|
||
|
* This library allows KDE applications to read and write images in a
|
||
14 years ago
|
* variety of formats, transparently via the TQImage and TQPixmap load
|
||
15 years ago
|
* and save methods.
|
||
|
*
|
||
|
* The image processing backends are written as image handlers compatible
|
||
14 years ago
|
* with the TQImageIO handler format. The backends are loaded on demand
|
||
15 years ago
|
* when a particular format is requested. Each format can be identified
|
||
|
* by a unique type id string.
|
||
|
*
|
||
|
* \b Formats:
|
||
|
*
|
||
|
* Currently supported formats include:
|
||
|
* @li BMP \<read\> \<write\>
|
||
|
* @li EPS \<read\> \<write\>
|
||
|
* @li EXR \<read\>
|
||
|
* @li G3 \<read\>
|
||
|
* @li GIF \<read\>
|
||
|
* @li ICO \<read\>
|
||
|
* @li JP2 \<read\> \<write\>
|
||
|
* @li JPEG \<read\> \<write\>
|
||
|
* @li NETPBM \<read\> \<write\>
|
||
|
* @li PCX \<read\> \<write\>
|
||
|
* @li PNG \<read\> \<write, only with newer libraries\>
|
||
|
* @li TGA \<read\> \<write\>
|
||
|
* @li TIFF \<read\>
|
||
|
* @li XBM \<read\> \<write\>
|
||
|
* @li XPM \<read\> \<write\>
|
||
|
* @li XV \<read\> \<write\>
|
||
|
*
|
||
|
* \b Usage:
|
||
|
*
|
||
|
* Simply call the KImageIO::registerFormats() static method declared
|
||
|
* in kimageio.h.
|
||
|
*
|
||
|
* \b Example:
|
||
|
*
|
||
|
* \code
|
||
14 years ago
|
* #include<tqpixmap.h>
|
||
15 years ago
|
* #include<kimageio.h>
|
||
|
*
|
||
|
* int main( int argc, char **argv )
|
||
|
* {
|
||
|
* ....
|
||
|
* KImageIO::registerFormats();
|
||
|
* ... // start main program
|
||
|
* }
|
||
|
* \endcode
|
||
|
*
|
||
14 years ago
|
* @see KImageIO, TQPixmap, TQImage, QImageIO
|
||
15 years ago
|
* @author Sirtaj Singh Kang
|
||
|
*/
|
||
12 years ago
|
class TDEIO_EXPORT KImageIO
|
||
15 years ago
|
{
|
||
|
public:
|
||
|
/**
|
||
|
* Possible image file access modes.
|
||
|
*
|
||
|
* Used in various KImageIO static function.
|
||
|
**/
|
||
|
enum Mode { Reading, Writing };
|
||
|
|
||
|
/**
|
||
|
* Registers all KImageIO supported formats.
|
||
|
*/
|
||
|
static void registerFormats();
|
||
|
|
||
|
/**
|
||
|
* Checks if a special type is supported for writing.
|
||
|
* @param type the type id of the image type
|
||
|
* @return true if the image format can be written
|
||
|
*/
|
||
14 years ago
|
static bool canWrite(const TQString& type);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Checks if a special type is supported for reading.
|
||
|
* @param type the type id of the image type
|
||
|
* @return true if the image format can be read
|
||
|
*/
|
||
14 years ago
|
static bool canRead(const TQString& type);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Returns a list of all KImageIO supported formats.
|
||
|
*
|
||
|
* @param mode Tells whether to retrieve modes that can be read or written.
|
||
|
* @return a list of the type ids
|
||
|
*/
|
||
14 years ago
|
static TQStringList types(Mode mode = Writing);
|
||
15 years ago
|
|
||
|
|
||
|
/**
|
||
|
* Returns a list of patterns of all KImageIO supported formats.
|
||
|
*
|
||
|
* These patterns can be passed to KFileDialog::getOpenFileName()
|
||
|
* or KFileDialog::getSaveFileName(), for example.
|
||
|
*
|
||
|
* @param mode Tells whether to retrieve modes that can be read or written.
|
||
|
* @return a space-separated list of file globs that describe the
|
||
|
* supported formats
|
||
|
*/
|
||
14 years ago
|
static TQString pattern(Mode mode = Reading);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Returns the suffix of an image type.
|
||
|
* @param type the type id of the file format
|
||
14 years ago
|
* @return the suffix of the file format or TQString::null if it does not
|
||
15 years ago
|
* exist
|
||
|
*/
|
||
14 years ago
|
static TQString suffix(const TQString& type);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Returns the type of a MIME type.
|
||
|
* @param mimeType the MIME type to search
|
||
14 years ago
|
* @return type id of the MIME type or TQString::null if the MIME type
|
||
15 years ago
|
* is not supported
|
||
|
* @since 3.1
|
||
|
*/
|
||
14 years ago
|
static TQString typeForMime(const TQString& mimeType);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Returns the type of given filename.
|
||
|
* @param filename the filename to check
|
||
|
* @return if the file name's suffix is known the type id of the
|
||
14 years ago
|
* file type, otherwise TQString::null
|
||
15 years ago
|
*/
|
||
14 years ago
|
static TQString type(const TQString& filename);
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Returns a list of MIME types for all KImageIO supported formats.
|
||
|
*
|
||
|
* @param mode Tells whether to retrieve modes that can be read or written.
|
||
|
* @return a list if MIME types of the supported formats
|
||
|
*/
|
||
14 years ago
|
static TQStringList mimeTypes( Mode mode = Writing );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Test to see whether a MIME type is supported to reading/writing.
|
||
|
* @param _mimeType the MIME type to check
|
||
|
* @param _mode Tells whether to check for reading or writing capabilities
|
||
|
* @return true if the type is supported
|
||
|
**/
|
||
14 years ago
|
static bool isSupported( const TQString& _mimeType, Mode _mode = Writing );
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Returns the MIME type of @p _filename.
|
||
|
* @param _filename the filename to check
|
||
14 years ago
|
* @return the MIME type of the file, or TQString::null
|
||
15 years ago
|
**/
|
||
14 years ago
|
static TQString mimeType( const TQString& _filename );
|
||
15 years ago
|
};
|
||
|
|
||
|
|
||
|
#endif
|
||
|
|