blob: 91101194a0a7f69a5e99e6a41c00455dd4a509cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#ifndef QT_CLEAN_NAMESPACE
#define QT_CLEAN_NAMESPACE
#endif
#include <ntqimageformatplugin.h>
#ifndef QT_NO_IMAGEFORMATPLUGIN
#ifdef QT_NO_IMAGEIO_PNG
#undef QT_NO_IMAGEIO_PNG
#endif
#include "../../../../src/kernel/qpngio.cpp"
class PNGFormat : public TQImageFormatPlugin
{
public:
PNGFormat();
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 & );
};
PNGFormat::PNGFormat()
{
}
TQStringList PNGFormat::keys() const
{
TQStringList list;
list << "PNG";
return list;
}
bool PNGFormat::loadImage( const TQString &format, const TQString &filename, TQImage *image )
{
if ( format != "PNG" )
return FALSE;
TQImageIO io;
io.setFileName( filename );
io.setImage( *image );
read_png_image( &io );
return TRUE;
}
bool PNGFormat::saveImage( const TQString &format, const TQString &filename, const TQImage &image )
{
if ( format != "PNG" )
return FALSE;
TQImageIO io;
io.setFileName( filename );
io.setImage( image );
write_png_image( &io );
return TRUE;
}
bool PNGFormat::installIOHandler( const TQString &name )
{
if ( name != "PNG" )
return FALSE;
qInitPngIO();
return TRUE;
}
Q_EXPORT_PLUGIN( PNGFormat )
#endif // QT_NO_IMAGEFORMATPLUGIN
|