]>
git.saurik.com Git - wxWidgets.git/blob - src/common/imagiff.cpp
2 // imgiff.cc - image handler for Amiga IFF images
3 // parts of the source taken by xv source code.
5 // (c) Steffen Gutmann, 2002
7 // Creation date: 08.01.2002
8 // Last modified: 08.01.2002
12 #pragma implementation "imagiff.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
26 #include "wx/imagiff.h"
27 #include "wx/iffdecod.h"
28 #include "wx/wfstream.h"
32 #if wxUSE_IMAGE && wxUSE_IFF
34 IMPLEMENT_DYNAMIC_CLASS(wxIFFHandler
, wxImageHandler
)
36 //-----------------------------------------------------------------------------
38 //-----------------------------------------------------------------------------
42 bool wxIFFHandler::LoadFile(wxImage
*image
, wxInputStream
& stream
,
43 bool verbose
, int WXUNUSED(index
))
49 decod
= new wxIFFDecoder(&stream
);
50 error
= decod
->ReadIFF();
52 if ((error
!= wxIFF_OK
) && (error
!= wxIFF_TRUNCATED
))
59 wxLogError(_("IFF: error in IFF image format."));
62 wxLogError(_("IFF: not enough memory."));
65 wxLogError(_("IFF: unknown error!!!"));
73 if ((error
== wxIFF_TRUNCATED
) && verbose
)
75 wxLogError(_("IFF: data stream seems to be truncated."));
76 /* go on; image data is OK */
79 ok
= decod
->ConvertToImage(image
);
85 bool wxIFFHandler::SaveFile(wxImage
* WXUNUSED(image
),
86 wxOutputStream
& WXUNUSED(stream
), bool verbose
)
89 wxLogDebug(wxT("IFF: the handler is read-only!!"));
94 bool wxIFFHandler::DoCanRead(wxInputStream
& stream
)
99 decod
= new wxIFFDecoder(&stream
);
100 ok
= decod
->CanRead();