diff options
Diffstat (limited to 'experimental/tqtinterface/qt4/plugins/src/imageformats/jpeg/main.cpp')
-rw-r--r-- | experimental/tqtinterface/qt4/plugins/src/imageformats/jpeg/main.cpp | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/experimental/tqtinterface/qt4/plugins/src/imageformats/jpeg/main.cpp b/experimental/tqtinterface/qt4/plugins/src/imageformats/jpeg/main.cpp new file mode 100644 index 000000000..6d4a42974 --- /dev/null +++ b/experimental/tqtinterface/qt4/plugins/src/imageformats/jpeg/main.cpp @@ -0,0 +1,76 @@ +#ifndef TQT_CLEAN_NAMESPACE +#define TQT_CLEAN_NAMESPACE +#endif +#include <tqimageformatplugin.h> + +#ifndef TQT_NO_IMAGEFORMATPLUGIN + +#ifdef TQT_NO_IMAGEIO_JPEG +#undef TQT_NO_IMAGEIO_JPEG +#endif +#include "../../../../src/kernel/qjpegio.cpp" + +class JPEGFormat : public TQImageFormatPlugin +{ +public: + JPEGFormat(); + + TQStringList keys() const; + bool loadImage( const TQString &format, const TQString &filename, TQImage * ); + bool saveImage( const TQString &format, const TQString &filename, const TQImage & ); + bool installIOHandler( const TQString & ); +}; + +JPEGFormat::JPEGFormat() +{ +} + + +TQStringList JPEGFormat::keys() const +{ + TQStringList list; + list << "JPEG"; + + return list; +} + +bool JPEGFormat::loadImage( const TQString &format, const TQString &filename, TQImage *image ) +{ + if ( format != "JPEG" ) + return FALSE; + + TQImageIO io; + io.setFileName( filename ); + io.setImage( *image ); + + read_jpeg_image( &io ); + + return TRUE; +} + +bool JPEGFormat::saveImage( const TQString &format, const TQString &filename, const TQImage &image ) +{ + if ( format != "JPEG" ) + return FALSE; + + TQImageIO io; + io.setFileName( filename ); + io.setImage( image ); + + write_jpeg_image( &io ); + + return TRUE; +} + +bool JPEGFormat::installIOHandler( const TQString &name ) +{ + if ( name.upper() != "JPEG" ) + return FALSE; + + qInitJpegIO(); + return TRUE; +} + +TQ_EXPORT_PLUGIN( JPEGFormat ) + +#endif // TQT_NO_IMAGEFORMATPLUGIN |