]>
git.saurik.com Git - wxWidgets.git/blob - src/common/imaggif.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxGIFHandler
4 // Author: Vaclav Slavik
5 // Based on wxGIFDecoder by Guillermo Rodriguez Garcia
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 We don't put pragma implement in this file because it is already present in
15 // For compilers that support precompilation, includes "wx.h".
16 #include <wx/wxprec.h>
27 // #include "wx/imaggif.h"
28 #include "wx/gifdecod.h"
29 #include "wx/wfstream.h"
30 #include "wx/module.h"
33 IMPLEMENT_DYNAMIC_CLASS(wxGIFHandler
,wxImageHandler
)
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
41 bool wxGIFHandler::LoadFile( wxImage
*image
, wxInputStream
& stream
, bool WXUNUSED(verbose
) )
46 decod
= new wxGIFDecoder(&stream
, TRUE
);
48 if (decod
->ReadGIF() != E_OK
)
50 wxLogDebug(_T("Error reading GIF"));
56 ok
= decod
->ConvertToImage(image
);
62 bool wxGIFHandler::SaveFile( wxImage
* WXUNUSED(image
),
63 wxOutputStream
& WXUNUSED(stream
), bool verbose
)
65 if (verbose
) wxLogDebug(_T("wxGIFHandler is read-only!!"));
69 bool wxGIFHandler::CanRead( wxInputStream
& stream
)
74 stream
.SeekI(-5, wxFromCurrent
);
75 return (hdr
[0] == 'G' && hdr
[1] == 'I' && hdr
[2] == 'F' && hdr
[3] == '8' && hdr
[4] == '9');