blob: ce37abb446a97c575fc228b4946935acc432cc0f (
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
|
#include <ntqimageformatplugin.h>
#ifndef TQT_NO_IMAGEFORMATPLUGIN
#ifdef TQT_NO_IMAGEIO_PNG
#undef TQT_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 // TQT_NO_IMAGEFORMATPLUGIN
|