]>
git.saurik.com Git - wxWidgets.git/blob - src/common/imaggif.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGIFHandler
4 // Author: Vaclav Slavik & Guillermo Rodriguez Garcia
6 // Copyright: (c) 1999 Vaclav Slavik & Guillermo Rodriguez Garcia
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "imaggif.h"
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
25 #if wxUSE_IMAGE && wxUSE_GIF
27 #include "wx/imaggif.h"
28 #include "wx/gifdecod.h"
29 #include "wx/wfstream.h"
33 IMPLEMENT_DYNAMIC_CLASS(wxGIFHandler
,wxImageHandler
)
35 //-----------------------------------------------------------------------------
37 //-----------------------------------------------------------------------------
41 bool wxGIFHandler::LoadFile( wxImage
*image
, wxInputStream
& stream
, bool verbose
, int WXUNUSED(index
) )
48 decod
= new wxGIFDecoder(&stream
, TRUE
);
49 error
= decod
->ReadGIF();
51 if ((error
!= wxGIF_OK
) && (error
!= wxGIF_TRUNCATED
))
58 wxLogError(_("GIF: error in GIF image format."));
61 wxLogError(_("GIF: not enough memory."));
64 wxLogError(_("GIF: unknown error!!!"));
72 if ((error
== wxGIF_TRUNCATED
) && verbose
)
74 wxLogError(_("GIF: data stream seems to be truncated."));
75 /* go on; image data is OK */
78 ok
= decod
->ConvertToImage(image
);
84 bool wxGIFHandler::SaveFile( wxImage
* WXUNUSED(image
),
85 wxOutputStream
& WXUNUSED(stream
), bool verbose
)
88 wxLogDebug(wxT("GIF: the handler is read-only!!"));
93 bool wxGIFHandler::DoCanRead( wxInputStream
& stream
)
98 decod
= new wxGIFDecoder(&stream
);
99 ok
= decod
->CanRead();
105 #endif // wxUSE_STREAMS