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.
tqt3/plugins/src/imageformats/jpeg/main.cpp

74 lines
1.4 KiB

#include <ntqimageformatplugin.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;
}
Q_EXPORT_PLUGIN( JPEGFormat )
#endif // TQT_NO_IMAGEFORMATPLUGIN