]> git.saurik.com Git - wxWidgets.git/blob - include/wx/anidecod.h
4fe25b6da85c89231fc300574c88db0fc2f93bd0
[wxWidgets.git] / include / wx / anidecod.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/anidecod.h
3 // Purpose: wxANIDecoder, ANI reader for wxImage and wxAnimation
4 // Author: Francesco Montorsi
5 // CVS-ID: $Id$
6 // Copyright: (c) 2006 Francesco Montorsi
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_ANIDECOD_H
11 #define _WX_ANIDECOD_H
12
13 #include "wx/defs.h"
14
15 #if wxUSE_STREAMS && wxUSE_GIF
16
17 #include "wx/stream.h"
18 #include "wx/image.h"
19 #include "wx/animdecod.h"
20
21
22 class /*WXDLLEXPORT*/ wxANIFrameInfo;
23
24 WX_DECLARE_OBJARRAY(wxANIFrameInfo, wxANIFrameInfoArray);
25 WX_DECLARE_OBJARRAY(wxImage, wxImageArray);
26
27 // --------------------------------------------------------------------------
28 // wxANIDecoder class
29 // --------------------------------------------------------------------------
30
31 class WXDLLEXPORT wxANIDecoder : public wxAnimationDecoder
32 {
33 private:
34
35 // frames stored as wxImage(s): ANI files are meant to be used mostly for animated
36 // cursors and thus they do not use any optimization to encode differences between
37 // two frames: they are just a list of images to display sequentially.
38 wxImageArray m_images;
39
40 // the info about each image stored in m_images.
41 // NB: m_info.GetCount() may differ from m_images.GetCount()!
42 wxANIFrameInfoArray m_info;
43
44 // this is the wxCURHandler used to load the ICON chunk of the ANI files
45 static wxCURHandler sm_handler;
46
47 public:
48 virtual wxSize GetFrameSize(size_t frame) const;
49 virtual wxPoint GetFramePosition(size_t frame) const;
50 virtual wxAnimationDisposal GetDisposalMethod(size_t frame) const;
51 virtual long GetDelay(size_t frame) const;
52
53 public:
54 // constructor, destructor, etc.
55 wxANIDecoder();
56 ~wxANIDecoder();
57
58 public: // implementation of wxAnimationDecoder's pure virtuals
59
60 virtual bool CanRead( wxInputStream& stream ) const;
61 virtual bool Load( wxInputStream& stream );
62
63 bool ConvertToImage(size_t frame, wxImage *image) const;
64
65 wxAnimationDecoder *Clone() const
66 { return new wxANIDecoder; }
67 wxAnimationType GetType() const
68 { return wxANIMATION_TYPE_ANI; }
69
70 private:
71 DECLARE_NO_COPY_CLASS(wxANIDecoder)
72 };
73
74
75 #endif // wxUSE_STREAM && wxUSE_GIF
76 #endif // _WX_ANIDECOD_H
77